Skip to main content
Known Participant
July 20, 2009
Question

Stop timer

  • July 20, 2009
  • 1 reply
  • 433 views

I have this code to time out my Flash movie and go to a URL

stop();

var jumpTimer:Timer = new Timer(5000);

jumpTimer.addEventListener( TimerEvent.TIMER, jump);

function jump(event:TimerEvent):void {
    navigateToURL(new URLRequest("http://www.yahoo.com"));
}

jumpTimer.start();

The only problem is that it opens a new URL window every five seconds. How can I get it to time out after 5 seconds, go to the URL and then stop before it opens another URL window?

Thanks!

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
July 20, 2009

if you just want to call that listener function once, use:


stop();

var jumpTimer:Timer = new Timer(5000,1);

jumpTimer.addEventListener( TimerEvent.TIMER, jump);

function jump(event:TimerEvent):void {
    navigateToURL(new URLRequest("http://www.yahoo.com"));
}

jumpTimer.start();

Known Participant
July 20, 2009

PERFECT!  I was wondering what that number after the comma was for.

Thanks!

kglad
Community Expert
Community Expert
July 20, 2009

you're welcome.