I'm trying to create a simple quiz in which you choose any answer, play correct / incorrect animation, you choose There are another question. Each question frame gives you 30 seconds to choose an answer and then sends you "ahead of time" to the frame, very simple. So far, everything is working except the timer. I can get it to work in the same frame, but when you click on a button or are redirected to another frame for some other reason, it crashes the whole program.
I think I can fix it, stop the timer on the "Exit Frame Event", however, only the timer was stopped from the start (while the rest of the program continues to work smoothly is);
Posting code will not be enough to file out for yourself:
I need this for school quiz and I have not found anything on the internet for the day. In the way I have been 'graphically' fully formed and linked, there can be many errors or errors, in this case I can not fix it without anyone tracking the whole program.
If you can only do anything with code of 1 frame:
import flash.events.TimerEvent; Import Flash. Var myTimer: timer = new timer (1000); MyTimer.addEventListener (TimerEvent.T.MER, CountdownHandler); Function CountDownHandler (Event: TimerAvent): Zero {countdown.text = 30-myTimer.currentCount + "s"; If (myTimer.currentCount == 30) {gotoAndStop (5)}}
This is my timer code, where frame 5 is "time up up" frame it works a bit nicely But how can I make it so that whenever a new frame is recorded with the timer, then it can be reset? (So, how do I stop it and restart it in some frames?);
Support will be highly appreciated!
Resolution: myTimer.stop (); MyTimer.removeEventListener (TimerEvent.T.MER, CountdownHandler); Added to the function called called by button, because it is a quiz, has the answer button and leads another frame, while the first to stop the timer and remove it from the listener (the above code goes before the goto frame And stops ...);
Although this is probably a very easy solution for help in other situations, quiz similar structure.
Special thanks to user LDMS: D
Comments
Post a Comment