有用的时间轴操作函数
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了有用的时间轴操作函数相关的知识,希望对你有一定的参考价值。
//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(); }
以上是关于有用的时间轴操作函数的主要内容,如果未能解决你的问题,请参考以下文章