iFocus.Life News News - Breaking News & Top Stories - Latest World, US & Local News,Get the latest news, exclusives, sport, celebrities, showbiz, politics, business and lifestyle from The iFocus.Life,

How to Convert Back to a UTC Date on AS3

104 44
    • 1). Create a new ActionScript 3.0 file in Flash by selecting "File/New."

    • 2). Use the Type tool to draw a text field in the middle of the stage. Select the text field and enter "date" as the instance name in the Properties panel. Click the "Show Border Around Text" icon.

    • 3). Enter the following code:

      var dat:Date = new Date();

      date.text = ""+dat;

      date.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverHandler);

      function fl_MouseOverHandler(event:MouseEvent):void{

      date.text = String("UTC:"+dat.getUTCFullYear()+"-"+ dat.getUTCMonth()+"-"+dat.getUTCDate()+" "+dat.getUTCHours()+":"+dat.getUTCMinutes()+":"+dat.getUTCSeconds());

      }

      date.addEventListener(MouseEvent.MOUSE_OUT, fl_MouseOutHandler);

      function fl_MouseOutHandler(event:MouseEvent):void{

      date.text = ""+dat;

      }

    • 4). Test the movie by selecting "Controls/Test Movie." Standard GMT date and time will be displayed in the text field. Place the mouse cursor over the text field and the UTC date and time will be displayed. Move the mouse out of the text field and the field will display GMT again.

Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time
You might also like on "Family & Relationships"

Leave A Reply

Your email address will not be published.