Flash AS3 Tutorial : How to link flash file to external webpages using AS3

flash-logoThis article will explain how you can link your button in your Flash file to external webpages. It will take the user to external webpages when user clicks the button in your flash content.

You can use ActionScript 3.0 to link from your Flash file to a webpage using the navigateToURL() method.

You can use navigateToURL() method as shown below.

navigateToURL(websiteURL, window);

Sample AS3 code for navigateToURL() :

function gotoPage(event:MouseEvent):void

{
var targetURL:URLRequest = new URLRequest(“http://dglobaltech.com/”);
navigateToURL(targetURL);
}

myBtn.addEventListener(MouseEvent.CLICK, gotoPage);


In AS2, we used getURL() for the same purpose. I’ve sample code below if you’re curious.

myBtn.onRelease = Function(){
getURL(“http://google.com”)
}

We Hope you like this article and it was very useful. Drop us a quick comment of feedback if you have any!