Tuesday, March 30, 2010

Stop timer

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!

Stop timer

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();

Stop timer

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

Thanks!

you're welcome.

  • beauty tips
  • No comments:

    Post a Comment