Open multiple links at the same time [AS3]

The classical navigateToURL will not work in a loop to open multiple links at the same time, so here is a good solution:

[code lang="as3"]

protected function button_clickHandler(n:Number):void
{
if (n < linksArray.length) {
navigateToURL(new URLRequest(linksArray[n]), '_blank');
callLater(callLater, [button_clickHandler, [n+1]]);

}

}
[/code]

here the MXML code:

[code lang="XML"]
<s:Button click="button_clickHandler(0)" label="Open Links"/>
[/code]

happy coding!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

Home
Twitter Facebook Flickr Vimeo About me Email me