|
-
play, then wait (a few seconds) then play etc
Hi
It would be great if someone could help me with this:
instead of having long stretches in my timeline it would be great to have a keyframe with actionscript 2 have the playhead wait a few seconds, then play.
is there an easy way to have this happen? and can i change the amount it waits on different key frames (3 seconds here, 5 seconds there) ?
thanks in advance
-
Ryan Thomson
i've never used the function, but check out setTimeout()
from the help docs:
Runs a specified function after a specified delay (in milliseconds). The setTimeout() function is similar to the setInterval() function, except that setTimeout() calls the function once and then is automatically deleted.
if that doesn't work you could probably also use setInterval
-
Flash 6, AS1 and Flash 7, AS2
Code:
_global.doPause = function(mc, secs) {
mc.stop();
var intID = setInterval(goOn, secs * 1000, mc);
function goOn(mc) {
clearInterval(intID);
mc.play();
}
};
// call the function like this
doPause(this, 2);
Flash 8, AS2
Take a look at setTimeout().
-
thanks for taking a look at my post.
i'm using cs3, actionscript 2 (i'm a designer not a programmer) so i'm not too nimble with the "look into Timeout() thing" looking into it for me means "ok, i saw it, now what".
so maybe i should phrase the problem a little differently...
what do you guys do when you want to hold frames in flash movies? do you press F5 like 200 times? or is there a smarter way to do it that you guys use?
-
Ryan Thomson
dawsonk provided the code to use already.
copy this to the main timeline:
PHP Code:
_global.doPause = function(mc, secs) { mc.stop(); var intID = setInterval(goOn, secs * 1000, mc); function goOn(mc) { clearInterval(intID); mc.play(); } };
then on any frame you want a pause put this code on the timeline:
PHP Code:
doPause(this, 2);
where 2 is the amount of time in seconds you want it to wait.
-
oh NICE, i thought it was for flash 6 or 7... like he said...
awesome. thanks dudes. why did you say it was for flash 6 or 7, it works fine for cs3?
-
Ryan Thomson
because for most setTimeout would be easier but it isn't supported in older versions. The code provided is supported in older versions, but it's also coded in as2 so you can use it on cs3 as long as you don't have your actionscript set to as3.
wow that sounded nerdy
-
lol. thanks for the help EvolveDesigns and dawsonk...
much appreciated.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|