"Flash Script Learning"  Flashプログラムの研究・ソース配布・Flashゲーム

タイマー機能

Top - Flash Plus - Flash Script Learning - タイマー機能


内容

ゲームなどの時間制限などに用いる、タイマー機能!

スクリプト

■タイマーMC
onClipEvent(load){
sf =0;
st =10;
this.timer = st;
}
onClipEvent(enterFrame){
if ( sf == 1){
t = Math.floor((getTimer()-startTime)/1000);
this.timer = st - t;
if (this.timer <= 0){
_root.gotoAndPlay(4);
}
}
}

■ボタン
on(release){
if (_root.disp.sf == 0){
_root.disp.sf = 1;
_root.disp.startTime = getTimer();
}else{
_root.disp.sf = 0;
}
}

対象バージョン

Flash 5以降

メニューへ戻る



Studio Chuma Works 2003-2005