How to Put Links in Flash Actionscript

Using ActionScript 3.0 doesn't necessarily have to be a daunting task. Flash CS3 can present many challenges, but putting links in your script is fairly easy. This step-by-step tutorial will show you how to add links to your buttons using ActionScript 3.0.

Instructions

    • 1

      Create a button in Flash.

    • 2

      Name your Flash button so that your button can later be referenced in the ActionScript.

    • 3

      Open up your Actions window. This can be done using the F9 key.

    • 4

      Create a function for your link. It should look like this:function LinkedButton(event:MouseEvent):void{}Make sure to note the capitalization and the curly brackets.

    • 5

      Put in the information for your link inside the two curly brackets. To do this, you must first create a new variable and a URL request: var yourVariable:URLRequest = new URLRequest("your URL").

    • 6

      Add one more line inside your curly brackets. It calls up your variable and tells the ActionScript to navigate to the URL you requested. It looks like this: navigateToURL(yourVariable, "_blank"). The "_blank" command will open your link in a new window and is optional.

    • 7

      Link your function to your button by adding an event handler. It should look like this: your_btn.addEventListener(MouseEvent.CLICK, LinkedButton);

    • 8

      Verify your final ActionScript looks like this: function LinkedButton(event:MouseEvent):void{ var yourVariable:URLRequest = new URLRequest("Your URL goes here") navigateToURL(yourVariable) }your_btn.addEventListener(MouseEvent.CLICK, LinkedButton);

Related Searches:

Resources

Comments

You May Also Like

Related Ads

Featured