Saturday, December 26, 2009

How To Create A Hyperlink

In this tutorial, you will learn how to create a hyperlink in Flash using ActionScript 3.

1. Go ahead and rename the default layer in your flash document to button. Create a new layer and rename it code.



2. Go to Insert >> New Symbol and create a new button and name it My_Button.



3. Rename the default layer to bg and create a new rectangle 120 wide and 40 high. Give it a color of #0053A4. Insert a new layer and rename it text. Create a static text field and align it properly.



4. Drag the button from the library into the button layer. Give it an instance name of my_button.

5. Go to the code layer and add the following code:


my_button.addEventListener(MouseEvent.CLICK, gotoURL);

function gotoURL(e:MouseEvent):void {
navigateToURL( new URLRequest( "http://www.flashsource.blogspot.com" ), "_blank" );
}

6. Save your work and test the movie.

Download Source
  • rss
  • Del.icio.us
  • Digg
  • Twitter
  • StumbleUpon
  • Reddit
  • Share this on Technorati
  • Post this to Myspace
  • Share this on Blinklist
  • Submit this to DesignFloat

0 comments:

Post a Comment