Oct
10
2008

getURL in Action Script 3

There is a little more to write when you want to link from Flash to some website. Action Script 2 offered getURL method, Action Script 3 doesn't have it anymore.

It's a good practise to use try - catch statement to track any issues when navigating to website.
1
2
3
4
5
6
7
8
9
10
var myURL:String = "http://sierakowski.eu";
var myURLRequest:URLRequest = new URLRequest(myURL);
try
{
navigateToURL(myURLRequest, '_blank'); // target can be _blank, _parent
}
catch (e:Error)
{
trace("Error when navigating to website!");
}
You can also use mailto: This e-mail address is being protected from spambots. You need JavaScript enabled to view it in your URL vairiable to create a link to send an email.

AS3 Tips