forked from: flash on 2010-5-4
import flash.events.MouseEvent;
/**
* Copyright umhr ( http://wonderfl.net/user/umhr )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/zunW
*/
// forked from horiuchi's flash on 2010-5-4
package {
import flash.display.Sprite;
import flash.events.Event;
//import flash.events.MouseEvent;
[SWF(backgroundColor = 0xDCDBB8)]
public class Main extends Sprite {
private var _shin1:Sprite;
private var _shin2:Sprite;
private var _shin3:Sprite;
public function Main() {
//背景
//var bg:Sprite=new Sprite();
//bg.graphics.beginFill(0xDCDBB8);
//bg.graphics.moveTo(0, 0);
//bg.graphics.lineTo(0, 465);
//bg.graphics.lineTo(465, 465);
//bg.graphics.lineTo(465, 0);
//bg.graphics.lineTo(0, 0);
//addChild(bg);
//秒針
_shin1=new Sprite();
_shin1.graphics.beginFill(0x636332);
_shin1.graphics.moveTo(-2, 0);
_shin1.graphics.lineTo(-2, -200);
_shin1.graphics.lineTo(2, -200);
_shin1.graphics.lineTo(2, 0);
_shin1.graphics.lineTo(-2, 0);
addChild(_shin1);
_shin1.x=465/2;
_shin1.y=465/2;
//分針
_shin2=new Sprite();
_shin2.graphics.beginFill(0x636332);
_shin2.graphics.moveTo(-4, 0);
_shin2.graphics.lineTo(-4, -200);
_shin2.graphics.lineTo(4, -200);
_shin2.graphics.lineTo(4, 0);
_shin2.graphics.lineTo(-4, 0);
addChild(_shin2);
_shin2.x=465/2;
_shin2.y=465/2;
//時針
_shin3=new Sprite();
_shin3.graphics.beginFill(0x636332);
_shin3.graphics.moveTo(-8, 0);
_shin3.graphics.lineTo(-8, -120);
_shin3.graphics.lineTo(8, -120);
_shin3.graphics.lineTo(8, 0);
_shin3.graphics.lineTo(-8, 0);
addChild(_shin3);
_shin3.x=465/2;
_shin3.y=465/2;
//時計の真ん中の丸
var maru:Sprite=new Sprite();
maru.graphics.beginFill(0x636332);
maru.graphics.drawCircle(0,0,15);
maru.graphics.endFill();
maru.x=465/2;
maru.y=465/2;
this.addChild(maru);
//時計の周りの点
for (var i:int = 0; i < 60; i++) {
var maru2:Sprite=new Sprite();
maru2.graphics.beginFill(0x636332);
if (i==0||i==5||i==10||i==15||i==20||i==25||i==30||i==35||i==40||i==45||i==50||i==55) {
maru2.graphics.drawCircle(0,-210,3);
} else {
maru2.graphics.drawCircle(0,-210,1);
}
maru2.graphics.endFill();
maru2.x=465/2;
maru2.y=465/2;
this.addChild(maru2);
maru2.rotation=6*i;
}
this.addEventListener(Event.ENTER_FRAME,onEnter);
}
private function onEnter(event:Event):void {
var date:Date=new Date();
_shin1.rotation=date.getSeconds()*6;
_shin2.rotation=(date.getMinutes()*6)+(date.getSeconds()/10);
var dateHour:Number=date.getHours();
if (date.getHours()>=12) {
dateHour=dateHour-12;
}
_shin3.rotation=(dateHour*30)+(date.getMinutes()/2);
}
}
}