PDA

View Full Version : waitScript for pausing timeline with a function


nagyordog
10-23-2009, 01:29 PM
I have been using the following script to pause the time line in 2.0 and it has been extremely effective. Is there any 3.0 version of the script? This is a global script, I basically just have to included a function "wait(<seconds to pause goes here>); and it pauses.

MovieClip.prototype.wait = function(ff_myPause) {
//waitScript 1.2, updated aug 29th 2005 by flowsen
this.stop();
if (ff_wait_cnt == undefined) {
_global.ff_wait_cnt = 0;
}
ff_wait_cnt++;
_global["ff_myFrame"+ff_wait_cnt] = this._currentframe;
_global["ff_myPath"+ff_wait_cnt] = this;
function ff_goFurther(ff_index) {
if (_global["ff_myPath"+ff_index]._currentframe == _global["ff_myFrame"+ff_index]) {
_global["ff_myPath"+ff_index].play();
}
clearInterval(_global["ff_waitInt"+ff_index]);
}
_global["ff_waitInt"+ff_wait_cnt] = setInterval(ff_goFurther, ff_myPause*1000, ff_wait_cnt);
};

//Very effective code to use to pause the frame for a second or seconds, simply
//put a function on the timeline written like this wait(1); This means that the timeline
//will pause for 1 second, before resuming play.

nagyordog
10-23-2009, 01:35 PM
Is there any code that works like the following I have been using with AS 2.0, where I place the following code on a key frame and I can use a function anywhere on the time line to pause it?

MovieClip.prototype.wait = function(ff_myPause) {
this.stop();
if (ff_wait_cnt == undefined) {
_global.ff_wait_cnt = 0;
}
ff_wait_cnt++;
_global["ff_myFrame"+ff_wait_cnt] = this._currentframe;
_global["ff_myPath"+ff_wait_cnt] = this;
function ff_goFurther(ff_index) {
if (_global["ff_myPath"+ff_index]._currentframe == _global["ff_myFrame"+ff_index]) {
_global["ff_myPath"+ff_index].play();
}
clearInterval(_global["ff_waitInt"+ff_index]);
}
_global["ff_waitInt"+ff_wait_cnt] = setInterval(ff_goFurther, ff_myPause*1000, ff_wait_cnt);
};

//Very effective code to use to pause the frame for a second or seconds, simply
//put a function on the timeline written like this wait(1); This means that the timeline
//will pause for 1 second, before resuming play.

henke37
10-24-2009, 07:55 PM
Run a Timer and wait for it to fire.