Esato Mobile
Sony Ericsson / Sony : Themes, ringtones, screensavers, games, video clips : FlashLite + ActionScript - Stopwatch from battery unplugged.
> New Topic
> Reply
< Esato Forum Index > Sony Ericsson / Sony > Themes, ringtones, screensavers, games, video clips > FlashLite + ActionScript - Stopwatch from battery unplugged. Bookmark topic
shdbnu Posts: 5

I need some help with this code...

I'm trying to do a stopwatch (HH:MM) that starts the minute I remove the charger, and resets when I put it back...
How can I do that?
My actual code don't reset and the minutes part don't back when reaches 60 minutos (like, 58, 59 then 00, 01, ...)


BatterySource = fscommand2("GetPowerSource");


if (BatterySource == 0) {
FlashTimer = getTimer();
milisecondsBatteryTime = FlashTimer;
minutesBatteryTime = Math.floor(milisecondsBatteryTime / 100 );
hoursBatteryTime = Math.floor(milisecondsBatteryTime / 1000 / 60 / 60);
minutesBatteryTimeString = (minutesBatteryTime hoursBatteryTimeString = (hoursBatteryTime BatteryTime.text = hoursBatteryTimeString + ":" + minutesBatteryTimeString;
}
else {
FlashTimer = 0;
BatteryTime.text = String("");
}
[ This Message was edited by: shdbnu on 2009-06-16 03:33 ]

--
Posted: 2009-06-16 04:33:08
Edit : Quote

kreacher Posts: 254

Should the code be something like -
minutes = Math.floor(milisecondsBatteryTime / 1000 / 60 );
hours = Math.floor(minutes / 60);
minutes = minutes % 60;
--
Posted: 2009-06-16 06:27:51
Edit : Quote

hihihans Posts: > 500

keep trying
--
Posted: 2009-06-16 09:12:15
Edit : Quote

shdbnu Posts: 5


On 2009-06-16 06:27:51, kreacher wrote:
Should the code be something like -
minutes = Math.floor(milisecondsBatteryTime / 1000 / 60 );
hours = Math.floor(minutes / 60);
minutes = minutes % 60;


what the % does?
--
Posted: 2009-06-16 15:40:11
Edit : Quote

Lightspeed_x Posts: > 500

% is the modulus operator
--
Posted: 2009-06-16 15:58:18
Edit : Quote

shdbnu Posts: 5

and why don't reset? anyone knows?
--
Posted: 2009-06-16 16:48:47
Edit : Quote

yea g Posts: > 500

you need to reset all the variables, not just the text label
--
Posted: 2009-06-16 23:15:03
Edit : Quote

shdbnu Posts: 5


On 2009-06-16 23:15:03, yea g wrote:
you need to reset all the variables, not just the text label



and how I do that?
--
Posted: 2009-06-17 00:17:37
Edit : Quote

shdbnu Posts: 5

great, the % 60 works perfect...


now how I reset them?
I've already tried everything, every variable on that script I've tried to equals 0... and nothing...


help plz?
--
Posted: 2009-06-19 03:13:24
Edit : Quote

New Topic   Reply
Forum Index

Esato home