Lately I had been working on flash websites that require a user to pause a movie on what ever frame it is on then continue on another press of a button.

So I thought I would post this code as it has come in handy on all my projects for major websites:

Quote:
/*
This code goes on the start on the movie clip or root
The buttons instance is called ‘actionBtn’ on line 2 of the AS you will see this
*/

var theCase:String = “doPlay”;
actionBtn.onRelease = function() {
if (_level0.theCase == “doPlay”) {
_level0.theCase = “doPause”;
} else {
_level0.theCase = “doPlay”;
}
trace(_level0.theCase);
};
this.onEnterFrame = function() {
if (_level0.theCase == “doPause”) {
this.stop();
} else {
this.play();
}
};

Leave a Reply

Your email address will not be published. Required fields are marked *

About Host Media

We have been hosting websites since 2002 and are always moving forward. All articles written under the Host Media author are created by the team who support our customers.

Category

Flash ActionScript {AS}

Tags

, ,