56フレームで降らせる雪をとめたいんですが、やり方が分かりません。
おしてください。
onClipEvent (load) {
//ムービーサイズをここで指定します
movieWidth = 300;
movieHeight = 250;
//variables that will modify the falling snow
i = 1+Math.random()*2;
k = -Math.PI+Math.random()*Math.PI;
//giving each snowflake unique characteristics
this._xscale = this._yscale=100+Math.random()*100;
this._alpha = 75+Math.random()*100;
this._x = -10+Math.random()*movieWidth;
this._y = -10+Math.random()*movieHeight;
}
onClipEvent (enterFrame) {
//putting it all together
rad += (k/180)*Math.PI;
this._x -= Math.cos(rad);
this._y += i;
if (this._y>=movieHeight) {
this._y = -5;
}
if ((this._x>=movieWidth) || (this._x<=0)) {
this._x = -10+Math.random()*movieWidth;
this._y = -5;
}
}
雪の一粒が、ひとつのムービークリップになってる、ってことですよね、きっと。
いろいろ方法はあると思うんですけど、例えばこんな感じででょうでしょう。
onClipEvent (enterFrame) { if (_root._currentframe < 56) { // ★ 56 フレームまで //putting it all together rad += (k/180)*Math.PI; this._x -= Math.cos(rad); this._y += i; if (this._y>=movieHeight) { this._y = -5; } if ((this._x>=movieWidth) || (this._x<=0)) { this._x = -10+Math.random()*movieWidth; this._y = -5; } } else { // ★ 56 フレームに達したら、ムービークリップを消しちゃう this.removeMovieClip(); } }
ぼくは、ActionScript って、さわったことが無いのですけれど、↓を参考にしてます。
http://hfm-kenchan.com/Lesson/log_qa/D0710151.htm
きちんと動いて、良かった。
2012/05/22 13:30:33実は、ドキドキしてました :-)
大丈夫です!
2012/05/22 13:50:24ちゃんと動きましたw
ありがとうございます^^