Restarting Animation

I’m trying to figure out how to restart a movie from the exact frame that it was stopped from. I have a circle rotation with the following script:

r=0
setProperty(“circle”, _rotation, r); r=r+1;
gotoAndPlay(2);

I know how to stop the rotation, but how do I get it to start again from the exact same spot?

Hey evadwash,
This is the way I did it. I made the circle a movie clip. Right click on the movie clip and select Actions. Copy and paste the following code there:


onClipEvent (load) {
	_root.speed = 1;
}
onClipEvent (enterFrame) {
	current = this._rotation;
	this._rotation = current + _root.speed;
}

Then, create a button and add the following action to it.


on (rollOver) {
	_root.speed =0;
}
on (rollOut) {
	_root.speed =1;
}
}

I believe you are using a frame to control whether the object is rotating or not. For sake of simplicity, I made a button that stops when rolled over and continues when rolled out. The key to remembering the position is the variable “current”. It remembers the current rotation of your object at all times. The _root.speed controls the speed of the rotation. When it is set to zero (when button is rolled over) the rotation simply stops.

Does this help? I have attached the FLA as well!

Cheers!
Kirupa :rambo:

Forgot the attachment =)

Thanks for replying Kirupa. That was almost exactly what I needed. The only difference is that I need the button to be rotating around with the circle as well. I’m having trouble finding a simple way of getting the button to rotate the same way the circle. Any suggestions?