jump to navigation

Open URL with Button in AC3 July 26, 2010

Posted by Tournas Dimitrios in Actionscript.
trackback

Actually this tutorial is for the beginner and demonstrates how to open a new URL  if a button is pressed .  First with your favorite Flash IDE create a button on the stage with a instance name of your choice ( vs. myButton_btn) and on the Actionscript layer write the following code 

//Button event Listener
myButton_btn.addEventListener(MouseEvent.CLICK , openUrl);

// This function handles the opening of the URL
function openUrl(evt:MouseEvent):void {
var url:URLRequest = new URLRequest("http://www.someUrl.com");
navigateToURL(url, "_blank");
}
Advertisements

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s