人力検索はてな
モバイル版を表示しています。PC版はこちら
i-mobile

flashでアクションスプリクトを使って雪を降らせるんですが、
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;
}
}

●質問者: *がっちゃん*
●カテゴリ:ウェブ制作
○ 状態 :終了
└ 回答数 : 1/1件

▽最新の回答へ

1 ● a-kuma3
ベストアンサー

雪の一粒が、ひとつのムービークリップになってる、ってことですよね、きっと。

いろいろ方法はあると思うんですけど、例えばこんな感じででょうでしょう。

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


*がっちゃん*さんのコメント
ホント助かりました^^ 56フレームで消えました!! これで、作業が進みますw

a-kuma3さんのコメント
きちんと動いて、良かった。 実は、ドキドキしてました <tt>:-)</tt>

*がっちゃん*さんのコメント
大丈夫です! ちゃんと動きましたw ありがとうございます^^
関連質問

●質問をもっと探す●



0.人力検索はてなトップ
8.このページを友達に紹介
9.このページの先頭へ
対応機種一覧
お問い合わせ
ヘルプ/お知らせ
ログイン
無料ユーザー登録
はてなトップ