VJ風ランダムテキスト
■ 説明 ■
TVノイズにランダムテキストを追加してVJ風にしています。
識別子を使用し読み込み、ランダムに配置しただけです。
フレーム1のスクリプト(ノイズなし)
_root.attachMovie("text1", "text_1", 3); //text1のインスタンスを生成
_root["text_1"].scale = 700; //スケール最大値を設定
_root["text_1"].onEnterFrame = random_me; //関数を呼び出す
_root.attachMovie("text2", "text_2", 2);
_root["text_2"].scale = 600;
_root["text_2"].onEnterFrame = random_me;
function random_me():Void {
this._x = 10+Math.round(Math.random()*Stage.width);
this._y = 10+Math.round(Math.random()*Stage.height);
this._xscale = this._yscale=Math.round(Math.random()*this.scale);
this._alpha = 10+Math.round(Math.random()*100);
}
| MC.attachMovie() | メソッド | シンボルから新規インスタンスを生成する |
|---|---|---|
| MC.attachMovie(識別子、新規インスタンス名、深度、複製いしたムービークリップに設定するプロパティを含むオブジェクト) | ||
| MC._x | プロパティ | インスタンスのX座標 |
| MC._y | プロパティ | インスタンスのY座標 |
| Math.round() | メソッド | 少数点以下を四捨五入して最も近い整数にする |
| Stage.width | プロパティ | ステージの幅 |
| Stage.height | プロパティ | ステージの高さ |
| MC.onEnterFrame | イベントハンドラ | フレームが再生されるたびに実行される |
