Going Somewhere?

Opening a URL in Action Script 3

Navigating to a URL in AS 2 was pretty straight forward.


As with most things in AS3 that has changed a fair amount. It is no longer one line of code. I’ll show you everything and then walk you through it

var myLink:URLRequest = new URLRequest();

myLink.url = “http://www.ryanwelcher.com”;


Ok first things first.

var mylink:URLRequest = new URLRequest();

myLink.url = “http://www.ryanwelcher.com”;

We created an instance of the URLRequest class called myLink and set the url property to http://www.ryanwelcher.com

Last step


This line actually makes the call and opens the url in a browser window. You can pass a second argument for the window type so to have the link open in a new window the code would be



For all you kids that want to keep it on one line, this is the same code all condensed.

navigateToURL(new URLRequest(“http://www.ryanwelcher.com”),”_blank”);

Leave a Reply