flash on 2010-12-6

by shapevent
♥0 | Line 23 | Modified 2010-12-06 03:00:41 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.*;
    import flash.events.*;
    import flash.text.*;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            
            var txt:TextField = new TextField();
            
            addChild(txt);
            
            var currDate:Date;

    // you can use an enterframe or a timer event here, doesn't matter which
    addEventListener(Event.ENTER_FRAME, onCheckTime);

    function onCheckTime(evt:Event):void{
      currDate = new Date();

      var hours:int = currDate.getHours();
      var minutes:int = currDate.getMinutes();
      var seconds:int = currDate.getSeconds();
      txt.text = hours + " " + minutes + " " + seconds;

      if (hours == 14 && minutes == 30 && seconds == 0){
         // do anything you want here
         dispatchEvent(new Event("eventX"));
      }
    }
            //
        }
    }
}