View Full Version : Wait a while in a frame
EssieP
05-12-2008, 11:23 AM
(v8/AS2)
I'd like to change the frame rate for some frames, but not others.
So, is it possible to put some kind of if-then-else loop on a keyframe, and make it wait before continuing without user input?
or...
Is there an easier way?
I don't want to start spreading out keys along the timeline.
Welcome aboard,
In AS2 based projects I do not believe there is a way to actually change the frame rate of your file at runtime. You can "fake it" however. You can use intervals (timers) to push your frames faster or slower then your frame rate.
Thing is, it doesn't sound like you need to change your frame rate anyway. If you are just asking how to make your file wait on a certian frame for some user input, simnply tell it to stop on that frame and have whatever the user's input is start it playing again.
So, say you were waiting for them to input something into a text field; you would throw a stop() command on the timeline at the frame you wanted the input, and then probably create a "Submit" button that the user would click on when they finished inputting the text. That submit button would tell the timleine to start playing again.
If you needed the timeline to pause and start again without a user input, you can use an interval to do it. An interval is basically a timer that launches a function when the time you have given it has expired.
atomic
05-12-2008, 06:47 PM
In other practical words...
Define a pause function on the first frame of your movie...
Something like...
var delay:Number;
function pause(){
play();
clearInterval(delay);
}
Then whenever you want to pause the playhead on some frame(s), simply add the following on that frame...
stop();
delay = setInterval(pause, 1000);
//500 (1/2second), 1000 (1 second) and 60000 (1 minute)...
EssieP
05-13-2008, 09:24 AM
atomic- you got my question clearly, I'm just about to try that.
I had a feeling setInterval() was in volved but could find nothing to demonstrate how.
atomic
05-13-2008, 01:05 PM
Grrrrreat! ;)
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.