# Timer Class loop

**URL:** <https://forum.kirupa.com/t/timer-class-loop/281701>\
**Category:** flash\
**Created:** [February 12, 2009, 10:45am UTC](https://forum.kirupa.com/t/timer-class-loop/281701 "2009-02-12T10:45:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vxd](https://avatars.discourse-cdn.com/v4/letter/v/848f3c/32.png) [@vxd](https://forum.kirupa.com/u/vxd)\
**Post date:** [February 12, 2009, 10:45am UTC](https://forum.kirupa.com/t/timer-class-loop/281701/1 "2009-02-12T10:45:08Z")

</div>

I’m trying to create a loop of a phone that rings every 5 seconds using the Timer Class.  
The problem I have is when it gets to function stopRing and noRingTimer.start(); it goes backs to function onTimerComplete not the start.

```auto

package {
    import flash.display.*;
    import flash.events.*;
    import flash.events.TimerEvent;
    import flash.utils.Timer;

    public class Phone extends MovieClip {
        var noRingTimer:Timer = new Timer(1000, 5);
        var ringTimer:Timer = new Timer(400, 8);

        public function Phone() {

            mPhoneScreen.visible = false;
            noRingTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
            ringTimer.addEventListener(TimerEvent.TIMER, ring);
            ringTimer.addEventListener(TimerEvent.TIMER_COMPLETE, stopRing);

            noRingTimer.start();

        }
        
        public function onTimerComplete(evt:TimerEvent):void {
            trace("Start ring!");

            ringTimer.start();

        }
        public function ring(evt:TimerEvent):void {
            mPhoneScreen.visible = !mPhoneScreen.visible;
            trace( "ring " + evt.target.currentCount)
        }
        public function stopRing(evt:TimerEvent):void {
            
            noRingTimer.start();
            trace("stop ring")
        }

    }
}

```
