A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: nedd help getting count down timer to stop

Hybrid View

  1. #1
    Junior Member
    Join Date
    Jan 2013
    Posts
    6

    nedd help getting count down timer to stop

    Can anyone help with this code it code i want it to stop at the year 1900



    var count:int = 2013;

    var myTimer:Timer = new Timer(100,count);

    myTimer.addEventListener(TimerEvent.TIMER, countdown);
    myTimer.addEventListener(TimerEvent.TIMER_COMPLETE , endTimer);

    myTimer.start();
    trace("timer started");
    function countdown(e:TimerEvent):void{
    myText_txt.text = String((count)-myTimer.currentCount);



    if(myText_txt.text == "1900"){
    myTimer.removeEventListener(Event.ENTER_FRAME, countDown);
    }
    // gotoAndStop(2)
    trace("timer ended");

    }
    //count--;

    function endTimer(e:TimerEvent):void{

    //trace("timer ended");
    }

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518
    Code:
    var count:int = 2013;
    var myTimer:Timer = new Timer(100,count);
    myTimer.addEventListener(TimerEvent.TIMER, countdown);
    myTimer.start();
    
    function countdown(e:TimerEvent):void {
            myText_txt.text = String((count)-myTimer.currentCount);
            if (myText_txt.text == "1900") {
                    myTimer.stop();
            }
    }

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