A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: dispatchEvent timer

Threaded View

  1. #1
    Member
    Join Date
    Apr 2011
    Posts
    42

    dispatchEvent timer

    Hey all,

    Iv'e got a game with a stopwatch timer in it which stops when the game is complete.

    The game swf is loaded when a button is clicked in the main menu swf.

    I want to be able to take the time at the end of the game and dispatch an event so that once back at the main menu once the game is finished the time can be displayed.

    Any ideas if this can be done as the time will be different each time the game is played.

    EDIT: Forgot the include code I used for the timer.

    function TimerHandler(e:TimerEvent):void
    {
    var Seconds:String = String(uint(MyTimer.currentCount%60));
    var Minutes:String = String(uint((MyTimer.currentCount/60)%60))
    var Hours:String = String(uint((MyTimer.currentCount/60)/60));

    SecondText.text = (uint(Seconds)< 10) ? "0" + Seconds:Seconds;
    MinuteText.text = (uint(Minutes)< 10) ? "0" + Minutes:Minutes;
    HourText.text = (uint(Hours) < 10) ? "0" + Hours:Hours;
    }
    Last edited by AntBirch; 02-15-2012 at 04:23 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center