/ Published in: ActionScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//will stop 'play', 'gotoAndPlay' and 'rewind', 'gotoAndRewind' functions MovieClip.prototype.stopAll = function () { delete this.onEnterFrame; this.stop(); } //will stop 'rewind', 'gotoAndRewind' functions MovieClip.prototype.stopRewind = function () { delete this.onEnterFrame; } //will play the timeline backwards and continal to loop until 'stopAll', 'stopRewind' or 'pause' are called //note: the 'rewind' function will cancel the 'play' function BUT the 'play' function will not cancel the 'rewind' function //you must call 'stopAll' or 'stopRewind' before using 'play' when your timeline is playing backwards MovieClip.prototype.rewind = function () { this.stop(); this.onEnterFrame = function () { if (this._currentframe > 0) { this.prevFrame (); } else { this.gotoAndStop (this._totalframes); } } } //will goto the specified frame and play the timeline backwards and continal to loop until 'stopAll', 'stopRewind' or 'pause' are called MovieClip.prototype.gotoAndRewind = function (frame) { this.gotoAndStop (frame); this.rewind(); } //will pause the timeline for the specified amount of time. will always play forwards when the pause has finished MovieClip.prototype.pause = function (time) { delete this.onEnterFrame; secondsToPause = time; pauseInt = setInterval (this, "restart", secondsToPause * 1000); } restart = function () { clearInterval (pauseInt); play(); }
URL: http://www.flashgroup.net/forum/showthread.php?t=2323