flash on 2010-10-9

by hacker_qb24ivfp
♥0 | Line 33 | Modified 2010-10-09 13:10:39 | MIT License
play

ActionScript3 source code

/**
 * Copyright hacker_qb24ivfp ( http://wonderfl.net/user/hacker_qb24ivfp )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/kI2g
 */

package {
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            //イベントリスナーでイベントを監視する
this.myclock.addEventListener(Event.ENTER_FRAME,nowClock);
//時計を更新する関数の定義
function nowClock(event:Event):void {
//現在の時分秒を調べる
var now:Date = new Date();
var ss:Number = now.getSeconds();
var mm:Number = now.getMinutes();
var hh:Number = now.getHours();
//時刻の数値から針の角度を計算する
ss=ss * 360 / 60;
mm=mm * 360 / 60;
hh=hh * 360 / 12 + mm / 12;
//角度の数値を針のインスタンスに適用する
this.myclock.second.rotation=ss;
this.myclock.minute.rotation = mm;
this.myclock.hour.rotation = hh;

//イベントリスナーでイベントを監視する
this.myclock.addEventListener(Event.ENTER_FRAME,nowClock);
//時計を更新する関数の定義
function nowClock(event:Event):void {
//現在の時分秒を調べる
var now:Date = new Date();
var ss:Number = now.getSeconds();
var mm:Number = now.getMinutes();
var hh:Number = now.getHours();
//時刻の数値から針の角度を計算する
ss=ss * 360 / 60;
mm=mm * 360 / 60 + ss / 60;
hh=hh * 360 / 12 + mm / 12;
//角度の数値を針のインスタンスに適用する
this.myclock.second.rotation=ss;
this.myclock.minute.rotation = mm;
this.myclock.hour.rotation = hh;
}
}

            
        }
    }
}