eHow launches Android app: Get the best of eHow on the go.

Click Here
How To

How to Put Links in Flash Actionscript

Contributor
By eHow Contributing Writer
(1 Ratings)

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.

Difficulty: Moderately Easy
Instructions
  1. Step 1

    Create a button in Flash.

  2. Step 2

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

  3. Step 3

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

  4. Step 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. Step 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. Step 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. Step 7

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

  8. Step 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);

Subscribe

Post a Comment

Post a Comment

Related Ads

  • Have you done this? Click here to let us know.
I Did This
Get Free Hobbies, Games & Toys Newsletters

Copyright © 1999-2009 eHow, Inc. Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy .   en-US Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. † requires javascript

eHow Hobbies, Games and Toys
eHow_eHow Hobbies, Games and Toys