Hey all!
I'm new to coding for phones, but I picked this one up and now I wanna hack the hell out of it! Saddly.. I'm having issues. The phone's interface is made in flash so I figured I could replace some of it with my own stuff.
First task - Make a flash wallpaper that displays the state of the battery. Sounded easy... first I did this for flash lite 2.1 which works great when previewed in device central:
PHP Code:
checkBattery();
vibrate = true;
function checkBattery(){
battLevel = fscommand2("GetBatteryLevel");
maxBattLevel = fscommand2("GetMaxBatteryLevel");
percent = Math.floor(battLevel/maxBattLevel*100);
battCounter.text = percent + "%";
battStats.text = "current level: " + battLevel + "\rtotal level: " + maxBattLevel;
//goto 75%
if(percent <= 75 && percent > 50){
battery.gotoAndStop(2);
}
//goto 50%
if(percent <= 50 && percent > 25){
battery.gotoAndStop(3);
}
//goto 25%
if(percent <= 25 && percent > 5){
battery.gotoAndStop(4);
}
//goto 5%
if(percent <= 5){
battery.gotoAndStop(5);
if(vibrate){
status = fscommand2("StartVibrate", 2000, 1000, 2);
}
vibrate = false;
}
}
//change to 60
checkTimer = setInterval(this, "checkBattery", 10000);
displays the battery state, if it's about to die it vibrates twice (ironic i know). No Go. It just kept saying 100% battery... so I tried coding in flash lite 1.1 even though the phone supports 2.1 because I ran out of ideas:
PHP Code:
battLevel = fscommand2("GetBatteryLevel");
maxBattLevel = fscommand2("GetMaxBatteryLevel");
percent = Math.floor(battLevel/maxBattLevel*100);
battCounter = percent;
//goto 75%
if(percent <= 75 && percent > 50){
tellTarget("battery"){
gotoAndStop(2);
}
}
//goto 50%
if(percent <= 50 && percent > 25){
tellTarget("battery"){
gotoAndStop(3);
}
}
//goto 25%
if(percent <= 25 && percent > 5){
tellTarget("battery"){
gotoAndStop(4);
}
}
//goto 5%
if(percent <= 5){
tellTarget("battery"){
gotoAndStop(5);
}
if(vibrate){
status = fscommand2("StartVibrate", 2000, 1000, 2);
}
vibrate = false;
}
still no go. both preview fine, neither work on the phone... it traces out the max battery as 4 and the current batter as 4 no matter what...
Anyone have any suggestions?
ps I forgot to mention, I've replaced one of the default swf wallpapers with my swf file using BitPim. I've also tried replacing the tipcalculator to the same ends