Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you time a loop to stop?

Status
Not open for further replies.

stygian

Technical User
Aug 9, 2001
4
0
0
US
I have a section of animation that repeats for a presentation, but at some point I need it to stop. Can't find a thing in the doc - only how to start it.
Thanks
Holly
 
Several ways depending.
Stopping it from within itself after some time.
Or, if this animation is in a movie clip (as it should be!), simply stopping it there and then, sending it and stopping it on it's first blank keyframe (if you have one!), or simply making it invisible at some point.

Regards,
new.gif
 
Here are a few options:

If your animation is in its own movieclip it can be stopped from the main timeline like this...

yourMovieclip.gotoAndStop(n)//where 'n' is the framenumber you want it to stop on.

If you want something to loop around three times (or howver many...) and stop then this would work if you put it in the last frame...

count++;
if(count==3){
stop();
}

Finally if you want to stop the looping clip at a particular time...

On your main timeline put this:

timeToStop=getTimer();
timeToStop+=10000;//this is the time in milliseconds (i.e. 10 sec delay)

On your looping movieClip attach this:

onClipEvent(enterFrame){
if(getTimer()>_root.timeToStop){
stop();
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top