原文(英語): How to make a battery indicator
対象となるバージョン: Flash Lite: 1.1, 2.x
Contents |
levelsNumber=8;
batMax = fscommand2("GetMaxBatteryLevel");
batLevel = fscommand2("GetBatteryLevel");
batSource = fscommand2("GetPowerSource");
batLevel2 = Math.ceil(batLevel*levelsNumber/batMax);
if (batSource == 0) { //If charger is not plugged
gotoAndPlay(batLevel2);
}
/* If charger is plugged, it will go to nextframe,
so the battery indicator will be animated.*/
call(1);
テキストインジケータを追加する必要がある場合
batText = "Battery Level: " add math.ceil(batLevel*100/batMax) add "%";
この例題は、下記サイトからダウンロードできます。
バッテリーインジケータ 240*320 (swf + fla)
No related wiki articles found