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

アナログ時計

Top - Flash Plus - Flash Script Learning - 簡易スライドショー


内容

アナログ時計のスクリプト
デジタルとは違い、MCに角度情報を送って
回転させてあげる必要がある。

スクリプト

onClipEvent (enterFrame) {
//時間を得る
now = new Date();
hour = now.getHours();
minute = now.getMinutes();
second = now.getSeconds();

//ラジアンに変換
rad_h = (hour%12)*30+int(minute/2);
//%は、割った余りを求める
rad_m = minute*6+int(second/10);
rad_s = second*6;

//計算
_root.hand_hour._rotation = rad_h;
_root.hand_minute._rotation = rad_m;
_root.hand_second._rotation = rad_s;
}

対象バージョン

Flash 5以降

メニューへ戻る



Studio Chuma Works 2003-2005