ActionScript 3.0 End Game Countdown Timer -


i'm making game in actionscript 3.0. have countdown timer (counts down 30 seconds). once 30 seconds want frame move frame 2 frame 3. have put gotoandstop(3) in code under timer when timer starts goes frame 3 straight away. doesnt go frame 3 when 30 seconds up. appreciate @ all!

var ncount:number = 30; var mytimer:timer = new timer(1000, ncount);  timer_text.text = ncount.tostring(ncount); mytimer.start();  mytimer.addeventlistener(timerevent.timer, countdown);  function countdown(e:timerevent):void {     ncount--;     timer_text.text = ncount.tostring();      gotoandstop(3); } 

you calling gotoandstop(3); on first timer event, i.e. after 1 second since not checking value of ncount. need call gotoandstop(3); when ncount zero.

function countdown(e:timerevent):void {     ncount--;     timer_text.text = ncount.tostring();      if (ncount == 0) {         gotoandstop(3);     } } 

Comments

Popular posts from this blog

android - How to save instance state of selected radiobutton on menu -

python 3 IndexError: list index out of range -

IF statement in MySQL trigger -