Archive

Posts Tagged ‘actionscript 3’

Flash Actionscript 3 URL link button

May 22nd, 2011 43 comments

What:

To make a button with a link to an external webpage using Actionscript 3

Example:

Click on the “alexbrooke.com” button in the top left corner to navigate away from this page

To find out how to do this go to the next page:

How:

1) Draw your button

2) Select your button and click on MODIFY then Convert to Symbol

3) Choose button from the menu and click OK

4) Select the button if it isn’t selected. Now give it an instance name of “urlButton” in the small dialog box in the bottom left hand corner

5) Create a new layer and insert the following actionscript into it:

function gotoHomePage(event:MouseEvent):void
{
var targetURL:URLRequest = new URLRequest(“http://yourhomepage.com/“);
navigateToURL(targetURL);
}
urlButton.addEventListener(MouseEvent.CLICK, gotoHomePage);

6) Change the red url to whatever website you want to navigate to.

7) Publish the movie and see if it works

Extra stuff

The video player I used for this example was made by Rafael Nuenlist. You can view the tutorial here.

Please leave your comments, ideas and questions here.

Post to Twitter Post to Facebook Post to StumbleUpon