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

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -