all groups > flash actionscript > october 2005 >
You're in the

flash actionscript

group:

Pausing a Script for X Time


Pausing a Script for X Time spectravp
10/29/2005 8:39:57 PM
flash actionscript:
Essentially, I have a function that is executed on a button click. In this
function, I trigger a movieclip to start playing. I want the function to sit
there and wait until the movieclip gets to a specific frame, then continue on.
I have tried using this: with no success:
_root.clapboard.gotoAndPlay("close"); ///<-- the "close" frame is #10
do {
trace("waiting for movie clip");
} while (_root.clapboard._currentframe != 25)

Apparently, as soon as a loop starts, movie clips stop playing. This results
in my clip being stuck at frame 10 and an infinite loop as it never reaches
frame 25. I also tried using setInterval() with no success.

Any suggestions? My noodle is getting burnt.
Re: Pausing a Script for X Time kglad
10/29/2005 9:13:38 PM
do-loops and for-loops execute from beginning to end before anything is updated
on-stage. so, they can't be made to work in your situation.

to remedy, use setInterval() or an enterFrame handler. the exact coding i'm
unable to determine because it's not clear what you mean by, " I want the
function to sit there and wait until the movieclip gets to a specific frame,
then continue on."

if you mean you want the code's execution to pause, that can't be done. you
work-around that limitation by separating your code into two functions, for
example.
AddThis Social Bookmark Button