Pausing Flash

hi,

im fairly new at flash and i want to be able to pause a frame before moving on to the next but im having problems any code i have found to do this doesnt work

can anyone help!

Would you be using a button to carry out the pause. If so you could try adding the stop(); action.

So you could use this in your button:


on(press) {
	_root.gotoAndStop(2)
}

That would mean the movie stayed on frame 2, but then if you were to have a play button you could make it start playing again.

I think this should help. :slight_smile:

i dont want to put in a button i just want to pause the frame thats the reason why im havin so much trouble.

thanx for the reply anyway!!!

Oh well maybe puting a stop(); action in the frame you would like to pause, might work.

I’m thinking a stop(); action would actually stop it rather than pause it :wink: Try the following:

Place this on the keyframe the pause will start:

this.pause = setInterval(this, "play", 5000);
 stop();

Then this on the very next keyframe:

clearInterval(this.pause);

Hope it helps :slight_smile:

I use this


[font=Arial][size=2][font=Arial]// Set the following two values for how long you want to[/font][/size][/font]

  [font=Arial][size=2][font=Arial]// loop, and how many frames to loop:[/font][/size][/font]

  [font=Arial][size=2][font=Arial]pauseDuration = 5*1000;[/font][/size][/font]

  [font=Arial][size=2][font=Arial]framesInLoop = 1;[/font][/size][/font]

  [font=Arial][size=2][font=Arial]if (startTime == null) {[/font][/size][/font]

  [font=Arial][size=2][font=Arial] startTime = getTimer();[/font][/size][/font]

  [font=Arial][size=2][font=Arial] gotoAndPlay (_currentframe-framesInLoop);[/font][/size][/font]

  [font=Arial][size=2][font=Arial]} else {[/font][/size][/font]

  [font=Arial][size=2][font=Arial] lapsedTime = getTimer()-startTime;[/font][/size][/font]

  [font=Arial][size=2][font=Arial]	if (lapsedTime < pauseDuration) {[/font][/size][/font]

  [font=Arial][size=2][font=Arial]	 gotoAndPlay (_currentframe-framesInLoop);[/font][/size][/font]

  [font=Arial][size=2][font=Arial]	} else {[/font][/size][/font]

  [font=Arial][size=2][font=Arial]		startTime = null;[/font][/size][/font]

  [font=Arial][size=2][font=Arial]	}[/font][/size][/font]

  [font=Arial][size=2][font=Arial]}[/font][/size][/font]

Change the settings in framesInLoop = 1; to keep the pause looping in either 1 frame or 5 or howmany other frames. pauseDuration = 5*1000; of course is the length of the pause.

Hey, thanks for this AS2 code.
I am guessing that 5000 means 5 seconds?
The code works half way. It will stop for 5 seconds and then replay. But it most of the time it will go right back to playing the flash and not take the 5000 time frame it should. Any suggestions?
Thanks

Of course, the best thing is not to put any code on any keyframe by using the document object.

Here’s a tutorial: http://www.gotoandlearn.com/play?id=43