Flash Timer
- Started
- Last post
- 16 Responses
- autonoma
What's a good method for making a flash movie 'hang' on a frame for, say, 15 seconds, and then move along?
- autonoma0
I know I could use getTimer, but can't figure out how to implement it.
- frogkiller0
just add 15 secs of blank frames
- autonoma0
Nah. Would rather use actionscript. I hate scrolling for hours to get to each clip.
- neeko0
without sitting down and figuring out the code, i do have a flash timer kicking around somewhere i could mail you... then you could just have the movie contnue when time = 15 seconds... let me know if you want it and what email address to send it to if you do... wont be able to send it to you till later tonight though.
- monkeywrench0
just had a friend asking for the same thing today. check out colin moock's waitAtTimer. it's a smartclip you can drop on a keyframe to pause your movie for a specified time (in milliseconds) it'll accept frame numbers or labels in quotes. you can find the fla on this page.
http://www.moock.org/asdg/codede…
direct link here
http://www.moock.org/asdg/codede…
- monkeywrench0
opps, sorry that's waitAtFrame smartclip
- keshuyu0
Use the setInterval method creates an event listener.
setInterval( callBackFunctionName, interval [, param1, param2, ... paramn])
- beani0
put this on an mc in the frame where you want the wait to occur:
onClipEvent(load){
startTime=getTimer();
countAmount=15;
elasped=0;
_parent.stop();
}
onClipEvent(enterFrame){
elapsed=getTimer()-startTime;
if (elapsed>=countAmount*1000){
_parent.play();
}
}
- neeko0
theres also a 'pause' component kicking around somewhere.
- autonoma0
I've done this:
function timer() {
stop();
frames = 4;
APause = setInterval(changeFrame, 15000);
function changeFrame() {
if (_currentframe == frames) {
gotoAndStop(1);
} else {
nextFrame();
clearInterval(APause);
}
}
}
timer();This works fine alone, but when I load this movie into the main movie, it no longer works.
- rico_escabar0
On frame 1 of your movie put this code:
function stopIt(){
stop();
waitInterval = setInterval(function(){ play(); clearInterval(waitInterval);}, 15000);
}then whey you want to stop for 15 seconds call the stopIt function:
stopIt();
So for example write stopIt(); on frame 10 of the movie and it will stop for 15 seconds.
- autonoma0
rico_escabar
That works well when I play that movie alone, but I'm actually going to be loading that movie into another, and when I do that it makes the main timeline play.
I'm loading the movie into an MC called 'sections' that rests on the main timeline of my main movie.
- autonoma0
Can someone tell me why it makes the _root timeline play after the 15 seconds when I load this movie instead of the clip this function rests in?
- gabe0
because with rico's code the actionscript sits on frame 1 of the root timeline.
thus, the play(); command is executed on the root timeline. target your MC where the play function is and you should be okay...
i.e. _root.sections.play();
- autonoma0
So say I have a movie called 'main.swf'. On main.swf's _root timeline, I have an empty clip called 'sections' where I use loadMovie to load another file called 'sectionOne.swf'. On frame 1 of sectionOne.swf's _root timeline is where I've placed this timer function, and this is the timeline that I use this function on.
I still need to target this specific MC even though this is not a global function?
- autonoma0
Nevermind guys. I've got it. Thanks for all of your help!