actionscript 3 - Countdown timer in flash frames -


i have countdown timer in flash. timer shows time in dynamic text field mytimer instance name. app in flash have frames next , button user can go next or frame. timer code inserted in action panel directly in first frame. issue this: when click on next or button go other frames,the timer disappear moment in new frame (about 1 second last show timer)? how can fix this?

  start_bt.addeventlistener(mouseevent.mouse_down, starter);    function starter(event:mouseevent):void   {  var timer:timer = new timer(1000,120); timer.addeventlistener(timerevent.timer, countdown); timer.start(); function countdown(event:timerevent) {     var totalsecondsleft:number = 120 - timer.currentcount;     if (totalsecondsleft==0)     {         gotoandstop(18);     }     mytimer.text = timeformat(totalsecondsleft); } function timeformat(seconds:int):string {     var minutes:int;     var sminutes:string;     var sseconds:string;     if (seconds > 59)     {         minutes = math.floor(seconds / 60);         sminutes = string(minutes);         sseconds = string(seconds % 60);     }     else     {         sminutes = "";         sseconds = string(seconds);     }     if (sseconds.length == 1)     {         sseconds = "0" + sseconds;     }     return sminutes + ":" + sseconds; } nextframe();     } 


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -