画像をフェードインする

ActionScriptで画像のフェードインをする。完全に表示されたら再度消える。

//初期状態は完全に透過
txt_mc.alpha = 0;

//イベントリスナー設定
txt_mc.addEventListener(Event.ENTER_FRAME,doAlpha);

function doAlpha(event:Event) {
//透過のスピード
txt_mc.alpha += 0.01;

//完全に表示されたら再び消える
if (txt_mc.alpha >= 1) {
txt_mc.alpha = 0;
   }
}

完全に表示されたとき(alpha=1の時)にリピートさせずに停止するにはremoveする。

txt_mc.removeEventListener(Event.ENTER_FRAME,doAlpha);

This movie requires Flash Player 9

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*