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

tclock

f
Get Adobe Flash player
by tipein123 13 Feb 2011
    Embed
/**
 * Copyright tipein123 ( http://wonderfl.net/user/tipein123 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/z0I4
 */

// forked from tipein123's quersummen
// f


package {
    import flash.geom.Point;
    import flash.display.*;
    import flash.events.*;
    import flash.utils.*;
    import flash.filters.*;
    import flash.text.*;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;


    [SWF(width="170",height="170",backgroundColor="0xcccccc",frameRate="60")]
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            
         stage.scaleMode = StageScaleMode.NO_SCALE;
         stage.align = StageAlign.TOP_LEFT;
         
         var Rund:Sprite = new Sprite;
         addChild (Rund);
         Rund.x = stage.stageWidth/2;
         Rund.y = stage.stageHeight/2;
         Rund.graphics.lineStyle(0,0x000000);
         Rund.graphics.drawCircle(0,0,80);
         Rund.graphics.lineStyle(0,0x333333);
         Rund.graphics.drawCircle(0,0,90);

         
         var hZeiger:Sprite = new Sprite;
         addChild (hZeiger);
         hZeiger.x = stage.stageWidth/2;
         hZeiger.y = stage.stageHeight/2;
         var mZeiger:Sprite = new Sprite;
         addChild (mZeiger);
         mZeiger.x = stage.stageWidth/2;
         mZeiger.y = stage.stageHeight/2;
         var sZeiger:Sprite = new Sprite;
         addChild (sZeiger);
         sZeiger.x = stage.stageWidth/2;
         sZeiger.y = stage.stageHeight/2;
         
         hZeiger.graphics.lineStyle(7,0x0000ff);
         hZeiger.graphics.moveTo(70,0);
         hZeiger.graphics.lineTo(80,0);
         
         mZeiger.graphics.lineStyle(3,0x00cc00);
         mZeiger.graphics.moveTo(60,0);
         mZeiger.graphics.lineTo(80,0);
         
         sZeiger.graphics.lineStyle(0,0xff0000); 
         sZeiger.graphics.moveTo(43,0);
         sZeiger.graphics.lineTo(80,0);

         
         
         
         var TextStyle:TextFormat = new TextFormat();
         TextStyle.font = "Arial";
         TextStyle.color = 0x123456;
         TextStyle.align = "center";
         TextStyle.size = 15;

            
         var tf:TextField = new TextField(); 
         
         tf.width = 500;
         tf.height = 140;
         tf.text = "Stundenlang";
         tf.setTextFormat(TextStyle);
         tf.x = stage.stageWidth/2-tf.width/2;
         tf.y = stage.stageHeight/2-30;

         addChild(tf);
         
         var sektimer:Timer = new Timer(100);
         sektimer.addEventListener(TimerEvent.TIMER, tictac);
         sektimer.start();
    
         function tictac(event:TimerEvent):void {
             var datum:Date = new Date();
             
             //datum.setMinutes(10);
             //datum.setHours(23);
             
             var Tag:String;
             Tag = "0000" + datum.getDate()
             Tag = Tag.substring(Tag.length-2,Tag.length);
             var Monat:String;
             Monat = "0000" + (datum.getMonth()+1); // Januar = 0
             Monat = Monat.substring(Monat.length-2,Monat.length);
             var Jahr:String;
             Jahr = "0000" + datum.getFullYear()
             Jahr = Jahr.substring(Jahr.length-2,Jahr.length);
             var Stunden:String;
             Stunden = "0000" + datum.getHours()
             Stunden = Stunden.substring(Stunden.length-2,Stunden.length);
             var Minuten:String;
             Minuten = "0000" + datum.getMinutes()
             Minuten = Minuten.substring(Minuten.length-2,Minuten.length);
             var Sekunden:String = "0000";
             Sekunden = Sekunden + datum.getSeconds()
             Sekunden = Sekunden.substring(Sekunden.length-2,Sekunden.length);
             var Wochentag:Array = ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"];

             tf.text = "" + Tag + "." + Monat + "." + Jahr + "\n" + Wochentag [datum.getDay()] + "\n" + Stunden + ":"+ Minuten+ ":"+ Sekunden;// "" + datum.getDay();
             tf.setTextFormat(TextStyle);
             
             
             
             
             sZeiger.rotation = datum.getSeconds()/60*360-90;
             //mZeiger.rotation = datum.getMinutes()/60*360-90;
             mZeiger.rotation = (datum.getMinutes()*60 + datum.getSeconds())/3600*360-90;
             //hZeiger.rotation = datum.getHours()/12*360-90;
             hZeiger.rotation = (datum.getHours()*3600 + datum.getMinutes()*60 + datum.getSeconds())/86400*360*2-90;
        }


        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
      }
    }
}