AS2 → AS3: Open New Browser Window
With the advent of ActionScript 3, there are new ways to do old things. Something as simple as opening up a new browser window in AS2 is a slight bit more complicated in AS3, but when all is said and done, the language makes sense and is very clear.
Let's take a look at opening a new browser window in AS2:
-
getURL("http://www.yahoo.com", "_blank");
And here is the AS3 version:
-
navigateToURL(new URLRequest("http://www.yahoo.com"), "_blank");
The navigateToURL function has replaced getURL and instead of taking a string it now takes a URLRequest. The second parameter is just like the getURL function, the browser window or HTML frame in which to display the document called by the URLRequest.
If you found this post useful, please consider leaving a comment, subscribing to the feed, or making a small donation.













Nice but in external class don't forget you need
import flash.net.URLRequest;
import flash.net.navigateToURL;