flash - Chronometer - Action Script 2.0 Local Storage -


1º. sorry english :) 2º. im newbie on this, nice please! local storage - action script 2.0 on adobe flash. have fla file, chronometer of records, days, hours, minutes , seconds. thing is, wanna save time on local storage, tried did not work. can u me please?

here´s code:

stop(); // stop scene animation timerclip.stop(); // stop movieclip animation  // initialise variables var day:number = 121; var hour:number = 23; var minute:number = 59; var second:number = 47; var record:number = 000;  timerclip.onenterframe = function() {   if (this._currentframe == 30) {          second += 1;       // seconds     if (second > 59) {                   second = 0;         seconds.text = "0" + second;         minute += 1;                      // minutes         if (minute >= 10) {             minutes.text = minute;         } else {             minutes.text = "0" + minute;         }          // hours         if (minute > 59) {             minute = 0;             minutes.text = "0" + minute;                             hour += 1;              if (hour >= 10) {                 hours.text = hour;             } else {                 hours.text = "0" + hour;             }             }         // dias         if (hour > 23) {             hour = 0;             hours.text = "0" + hour;                             day += 1;              if (day >= 10) {                 days.text = day;                             } else {                 days.text = "00" + day;             }             }     } else {                     if (second >= 10) {             seconds.text = second;         } else {             seconds.text = "0" + second;         }      // records     if (record > day) {                  record = record;         records.text = 0 + record;         } else {             records.text = day;         }         }        } } 

here .fla https://www.4shared.com/file/ptzpnh2eca/chronometer.html

ty !

i'm not sure you'd getting error, if declared & retrieved sharedobject on root timeline, after initial variables:

var day:number = 121; var hour:number = 23; var minute:number = 59; var second:number = 47; var record:number = 000;  var so:sharedobject = sharedobject.getlocal("record");  if (so.data.record) {     record = number(so.data.record);     trace(record); } 

this should sit outside of onenterframe function, otherwise you'll attempting call 30 times per second. assuming record has been committed sharedobject, trace expected.

on record buttons, add following on (release) {} functions:

so.data.record = record; so.flush(); 

since so declared on root, write appropriate value sharedobject every time click buttons. next time run swf, load local storage.


Comments

Popular posts from this blog

how to add preprocess loader in webpack 2 -

python - django admin: changing the way a field (w/ relationship to another model) is submitted on a form so that it can be submitted multiple times -

go - serving up pdfs using golang -