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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pausing a movie. 1

Status
Not open for further replies.

TruthInSatire

Programmer
Aug 12, 2002
2,964
US
I'm a flash nub.
I know the basics, tweening and stuff.
I'm trying to use flash to make a visual walk-threw.
my first (of i'm sure many) question is, what is the best way to "pause" an animation? I want everything to stop for about 3 or 4 seconds, but don't want to do it by adding large amounts of empty frames. it isn't waiting for user interaction, just pausing. thanks in advance.
 
to the frame where you wish the pause add

stop();
myPause = setInterval(holdIt,4000); //4 secs
function holdIt(){
clearInterval(myPause);
play();
}
 
That worked great thanks.
Another question.
I see how setInterval works, like setTimeout in JS.
is clearInterval and setInterval a required pair? do I have to do a clearInterval? or could i just go straight to play()?
 
if you dont clear an interval then it just keeps calling over and over. can be very cpu intensive.
 
In fact if you define the function in the first frame of your movie...

function holdIt(){
play();
clearInterval(myPause);
}

All you have to do when you want a pause is to use...

stop();
myPause = setInterval(holdIt,4000); //
// Where 4000 is 4 seconds and 60000, one minute.

No need to repeat the defining of the function.



Regards,

cubalibre2.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top