Groups | Blog | Home
all groups > flash actionscript > october 2005 >

flash actionscript : A very simple actionscript I am after



chabakhan
10/4/2005 9:48:53 PM
I guess the Summary says it all. A very beginner question I know...but gotta
start somewhere.lol
Basically like to know if I have 2 or 3 scenes how could I pause for a couple
of seconds between them therefore creating a comfortable viweing time....????

Thanks!
mandingo
10/4/2005 11:21:05 PM
look at setInterval();

delayFunction = function(clip){
clearInterval(thisDelay);
clip.play(); // or whatever action

}

thisDelay = setInterval(delayFunction,5000,this); // delay of 5 seconds

cheers
chabakhan
10/4/2005 11:42:42 PM
Thanks so much!
Now do I just copy this :
_____________________________________
look at setInterval();

delayFunction = function(clip){
clearInterval(thisDelay);
clip.play(); // or whatever action

}

thisDelay = setInterval(delayFunction,5000,this); // delay of 5 seconds



.....whole thing into the script??????



Would this be correct????

_______________________________________
stop();

//stops the playhead at frame 15 stop();

look at setInterval();

delayFunction = function(clip){
clearInterval(delayFunction,15000,this);
clip.play(); // or whatever action

}

thisDelay = setInterval(delayFunction,5000,this); // delay of 5 seconds


nextScene();
NSurveyor
10/5/2005 12:07:02 AM
Put this code on the last frame of every scene:

stop();
delayFunction = function(clip){
clearInterval(thisDelay);
clip.play();
}
mandingo
10/5/2005 12:13:45 AM
no...

If you want that more re-usable then something like this...

myDelayFunction = function(clip,frame){
clearInterval(myDelay);
clip.gotoAndPlay(frame);
}

myDelay = setInterval(myDelayFunction,15000,this,"frameLabel");


Now in that example, what you are looking at is that the last line is the only
thing that needs to change...

myDelay is setting a call to a function called myDelayFunction at an interval
of 15 seconds and it is passing in two parameters, the first is the timeline
that it resides on (and more importantly, the timeline we are going to play on)
and then the second parameter is the frameLabel that we want to go to.

so if you needed to re-use this later, the you use the same basic
construction...

myDelay = setInterval(myDelayFunction,15000,this,"otherFrameLabel");

There is much discussion on this forum about the use of setInterval and my
original example covers the basic implementation. If you know in advance how
long each interval is to be, then it is possible to pass in an array of times
and frameLabels and deal with them all in one function. Check the archives for
other examples of using setInterval

cheers
AddThis Social Bookmark Button