This content has been marked as final. Show 3 replies
You have an onEnterFrame function that is running continuously, even after you think you've finished with it. So, what is happening is that when the if condition returns true the first time, the playback head will jump forward to frame 2. However, the onEnterFrame function will continue to run. And the if condition will still be true, and so the playback head will get pulled back to frame 2, over and over, and over...
What you want to do is to kill the onEnterFrame function when you are finished with it. You can do that by putting "delete onEnterFrame" after the gotoAndPlay(2); line.
Alternately, you could use a setInterval function and then use clearInterval to remove the event.
Thanks very much... that worked well - See attached code - and it fixed the initial problem. But now I've created another small problem. After I initiate a CONTINUE out of that particular loop, if the next sequence in the timeline takes longer than 2000 to reach the next set of frame instructions, it kicks everything back to the original frame. Hope Im being clear on that.
In other words it appears as though my timer resets and counts again and again.
How do I make it count once and then kill it?
Is this where clearInterval can come into play/ If so how do I set it up?
There's nothing wrong with your code. If your movie is looping back to some previous frame then something else is wrong. If Flash, before CS3, encounters a goto action that it can't resolve, it will send the playback head back to the first frame in the local timeline.
The setInterval alternative to enterFrame loop looks like this: