forked from: forked from: forked from: forked from: forked from: 超超超シンプル時計。
// forked from wf_mizzkey's forked from: forked from: forked from: forked from: 超超超シンプル時計。
// forked from iara's forked from: forked from: forked from: 超超超シンプル時計。
// forked from iara's forked from: forked from: 超超超シンプル時計。
// forked from paq's forked from: 超超超シンプル時計。
// forked from paq's 超超超シンプル時計。
//前より、マシになった。
package {
import flash.events.Event;
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.net.URLRequest;
[SWF(width="765",height="465",backgroColor="#0000",frameRate="60")]
public class Clock extends Sprite{
[Embed(systemFont="sansserif", fontName="font", unicodeRange="U+0030-U+0039,U+003A", mimeType="application/x-font")]
private var font:Class;
public var textField:TextField = new TextField();
public var date:Date;
public var str:String = new String();
public function Clock():void {
var format:TextFormat = new TextFormat();
format.font = "font";
format.size = 100;
format.color = 0x000000;
textField.embedFonts = textField.wordWrap = true;
textField.selectable = false;
textField.defaultTextFormat = format;
textField.x = 200;
textField.y = 465/2-50;
textField.width = 765;
textField.height = 100;
addChild(textField);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame(e:Event):void {
date = new Date();
str = "";
str += (date.hours < 10 ? "0" : "") + date.hours;
str += ":";
str += (date.minutes < 10 ? "0" : "") + date.minutes;
str += ":";
str += (date.seconds < 10 ? "0" : "") + date.seconds;
//str += ":";
//str += (date.milliseconds < 100 ? "0" : "") + (date.milliseconds < 10 ? "0" : "") + date.milliseconds;
textField.text = str;
}
}
}