In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

flash on 2010-6-20

Get Adobe Flash player
by unic210 19 Jun 2010
    Embed
package {
 
    import flash.events.Event; 
    import flash.display.Sprite; 
    import flash.text.TextField; 
    import flash.text.TextFormat; 
    import flash.net.URLRequest; 

  [SWF(width="465",height="465",backgroundColor="#ffffff",frameRate="60")] 
    public class Clock extends Sprite{ 
        [Embed(systemFont="serif", 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 = 70; 
            format.color = 0x000000; 

            textField.embedFonts = textField.wordWrap = true; 
            textField.selectable = false; 
            textField.defaultTextFormat = format; 
            textField.x = width / 2; 
            textField.y = 465 / 2 - 50; 
            textField.width = 465; 
            textField.height = 70; 
            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; 
        } 
    } 
}