Groups | Blog | Home
all groups > flash actionscript > may 2004 >

flash actionscript : stop on frame for x seconds, then continue?


rswiiiix
5/23/2004 6:40:28 PM
hello,
i am making a simple header with some bitmaps that fade in/out.
i would like the bitmap to stay at 0 transparency for say 9 seconds, then fade
out while the next one fades in, etc...
instead of making the time line incredibly long, while the playhead moves
through basically inactive frames, i am wondering if there is a bit of script i
can attach that will stop the playhead on a frame, then just start it up again
after 9 seconds?
thanks,
rswiiiix
kglad
5/23/2004 7:44:07 PM
Ben2
5/24/2004 3:48:16 AM
mandingo
5/24/2004 3:59:38 AM
Simple...

function myDelayFunction(){
trace("I had to wait for 9 seconds before firing");
clearInterval(myTimingDelay);
}
myTimingDelay = setInterval(myDelayFunction,9000);

hope that helps,
cheers,
Ben2
5/25/2004 3:43:13 AM
Oh cool, that actually works, thanks.

mandingo
5/25/2004 3:46:08 AM
Flash Nick
5/25/2004 5:28:14 AM
It won't work unless you are using the Flash 6 Player or later, setInterval is
not available in earlier players. This same issue came up in another thread
(repeat loop) and Jack posted some code that should with earlier Flash Players.
Here it is (thanks Jack!):

stop();

fps = 12; // movie speed
secs = 10;
frames = fps*secs;
tick = 0;

this.onEnterFrame = function(){
tick++;
tick %fps ? trace(int(tick/12)+"sec") : null;
if(tick == frames){
trace("time up");
play();
delete this.onEnterFrame;
}
};


AddThis Social Bookmark Button