0

as2 のフレーム 109 でこのアニメーションを停止しようとしています。これを止めるために私が広告する必要があるものについての助け。紙吹雪アニメーションです。

cnfNumber = 85;
var cnfs:Array = new Array("cnf", "cnf2", "cnf3","cnf4","cnf5") 
for (i=0; i<cnfNumber; i++) {
    newCnf = _root[cnfs[random(cnfs.length)]].duplicateMovieClip("snow"+i, i);
    newCnf._x = Math.random()*Stage.width;
    newCnf._y = -Math.random()*300;
    newCnf.maxCnfSpeed = Math.random()*4;
    newCnf.wind = Math.random()*6;
    newCnf._xscale = newCnf._yscale = newCnf.alpha = Math.random()*65+35
    newCnf.onEnterFrame = function() {
        this._rotation -= this.maxCnfSpeed+1;
        if(this._y>Stage.height || this._x>Stage.width || this._x<0){
            this._y = -Math.random()*300;
            this._x = Math.random()*Stage.width;
        } else {
            this._y += this.maxCnfSpeed+2;
            this._x += this.wind-4;
        }

        this._alpha = this.alpha;
    };
}
4

1 に答える 1

0

なぜこれをしないのですか:

newCnf._xscale = newCnf._yscale = newCnf.alpha = Math.random()*65+35
newCnf.frameCount = 0;
newCnf.onEnterFrame = function() {
    if(this.frameCount<109) {
        this._rotation -= this.maxCnfSpeed+1;
        if(this._y>Stage.height || this._x>Stage.width || this._x<0){
            this._y = -Math.random()*300;
            this._x = Math.random()*Stage.width;
        } else {
            this._y += this.maxCnfSpeed+2;
            this._x += this.wind-4;
        }
        this._alpha = this.alpha;
        this.frameCount++;
    } else {
        this.onEnterFrame = null;
    }
};

私はしばらく Actionscript を使っていないので、this.onEnterFrame = null正確ではないかもしれませんが、厳密には必要ではありません。紙吹雪がフレーム番号をチェックして、アニメーション化が完了したらすべてのフレームを救済するのを防ぐだけです。

紙吹雪をその場で凍らせるのではなく消したい場合は、そのonEnterFrame. 頭のてっぺんからそれを行う関数を覚えていませんが、ドキュメントにduplicateMovieClipはそれへのリンクが必要です。

(なぜまだ AS2 を使用しているのかは尋ねません。)

于 2013-09-20T20:49:48.190 に答える