PDA

View Full Version : pause a flash movie


cpt_viper
08-31-2006, 07:38 PM
Hello,

Flash is a very usefull program for making some basic animations that I use in presentations for work. However I need to set a pause right in the middle of one of my animations to explain what is happening to the audience. However, I dont know how to add in a pause. What I need is to pause the movie and leave it on one frame for a given amount of time in seconds. I use Flash 8. If somebody could please explain to me with actionscript or however it can be done.

Thanks in advance,
Regards, Gareth

buginajar
08-31-2006, 08:12 PM
Hello,

Flash is a very usefull program for making some basic animations that I use in presentations for work. However I need to set a pause right in the middle of one of my animations to explain what is happening to the audience. However, I dont know how to add in a pause. What I need is to pause the movie and leave it on one frame for a given amount of time in seconds. I use Flash 8. If somebody could please explain to me with actionscript or however it can be done.

Thanks in advance,
Regards, Gareth

Try this


//Pause Prototype
//----------------------------
MovieClip.prototype.pauseMe = function(pauseTime:Number):Void{

this.stop();

this.createEmptyMovieClip("pauseMC",this.getNextHighestDepth());

this.pauseMC.startTime = getTimer();
this.pauseMC.pauseTime = pauseTime*1000;

this.pauseMC.onEnterFrame = function():Void{
if(getTimer() - this.startTime < this.pauseTime){
//keep waiting
}else{
delete this.onEnterFrame;
this._parent.play();
this.removeMovieClip();
}
}
}


//Implementation
//--------------------------
targetMC.pauseMe(10);

Wildmac
09-02-2006, 06:09 PM
I'm using the code above in my movie, and it's basic function is working, but... I'm using it to hide a MC when the timer finishes. The problem is the action still continues behind the scenes. What I need to do is to pause the rest of the action behind. But I don't now how.

The Position Thumbs Function below is loading a scrolling navbar. Once it loads, the animation tied to that scrollbar automatically starts playing. I want it to pause until the end of the timer. Can anyone tell me how?...


// Position Thumbs Function
function positionThumbs():Void {
// We'll need local variables for the height and width of each thumb
var loc_w:Number, loc_h:Number;
// We'll use this variable to position the thumb on the x-axis
var next_x:Number = 5;
// Loop through the thumbs
for (var i:Number = 0; i < toLoad; i++) {
// Get a reference to the thumbnail MC
var tgt_mc:MovieClip = eval(String(holder) + ".Image_"+String(curAlbum)+"_"+String(i));
// Set it's x property using the next_x var
tgt_mc._x = next_x;
// Set loc_h and loc_w
loc_h = tgt_mc._height;
loc_w = tgt_mc._width;
// Position the thumb centered vertically (assumes thumb are is 100px high)
tgt_mc._y = (80-loc_h)/2;
// Set the next_x for the next thumb
next_x += loc_w+5;
}
// All have loaded, fade out the loading thumbs message

//Pause Prototype
//----------------------------
pauseMe = function(pauseTime:Number):Void{

this.stop();

this.createEmptyMovieClip("pauseMC",this.getNextHighestDepth());

this.pauseMC.startTime = getTimer();
this.pauseMC.pauseTime = pauseTime*1000;

this.pauseMC.onEnterFrame = function():Void{
if(getTimer() - this.startTime < this.pauseTime){
//keep waiting
}else{
delete this.onEnterFrame;
this._parent.play();
this.removeMovieClip();
loading_mc.tween("_alpha", 0, 3);
}
}
}


//Implementation
//--------------------------
pauseMe(6);

}