内容
アナログ時計のスクリプト デジタルとは違い、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以降
メニューへ戻る