Flash Components      Flash Menu      Flash Gallery      Flash Slideshow      FLV Player      Flash Form      MP3 Player      PhotoFlow      Flash CMS      3D Wall      Flash Scroller

 tutorials:
  Flash 8
  Flash MX 2004
  Flash MX
    Flash 5
  Basic
  Animation
  Special Effects
  Advanced
  Forums
  ActionScript
  Graphics | Motion
  PHP and XML
  Web Technologies
  Swift 3D
   
 

 
 

 

 

 

 

 

 

 

 
Linking
A Button

Sometime or another, you are going to be linking your Flash animation to another page through your Web browser. In Flash, only buttons can be used to link to another page when the user clicks the mouse. This tutorial will teach you how to link to another page and the various window states that can be used.

Click the button to see what you will have created by the end of this tutorial:

Creating And Making The Button Work:

First, download the partial FLA for this tutorial by clicking here. The partial FLA only includes the button with no actual coding. You will add the small portion of code yourself!

Here's How:

  1. Once you have opened the partial FLA, right click on the button and select Actions. Next, click the plus sign ( + ) and select Basic Actions | Get URL.


 

  1. Once you select Get URL, you will see the current Object Actions window display the various fields for creating and modifying a URL (Uniform Resource Locator).
     
  2. In the URL field, enter the address http://www.yahoo.com. When the button is clicked, it will take the visitor to Yahoo's home page.
     
  3. Publish the animation and preview it in your browser (File | Publish Preview | HTML). Once the button is clicked, Yahoo's home page will load in the current browser window.

Opening in a Separate Browser Window
When the button was clicked, Yahoo loaded in your current browser window. Most of the time, you would rather have people stay on your site while visiting another site at the same time. To accomplish that, many sites open links pointing to pages outside of their site in a separate browser window. You too can do that to your animation.

Right click on the button and select Actions. You will see the Object Actions window. Select the second line of code that says "getURL". The URL fields will be displayed again. Click the Window drop-down menu and select _blank. The _blank setting will allow the link (URL) you specified to open in a new browser window.

Below you will find an explanation about each selection in Window drop-down menu:

  • _self
    Loads the link in the current page or the current page in a Frame. This is the default selection used by Flash to open any link.
     
  • _blank
    Loads the link in a separate browser window. You selected _blank in the tutorial above.
     
  • _parent
    Loads the link into the frameset file of a frame. The frameset file controls all the frames, and setting the window to _parent will eliminate frames in the subsequent links. As you may have seen, often times, links get loaded inside frames unintentionally. Setting _parent will solve the misuse of frames!
     
  • _top
    Loads the link on the top frame.

To see how my FLA looks like compared to yours, download my FLA by clicking here. Also, if you are interested in making a new window open without having to display the browser buttons, address bar, etc. you should look at the JavaScript Window Open tutorial by clicking the following link:

Opening a New Browser Window in Flash

I hope the information helped. If you have any questions or comments, please don't hesitate to post them on the kirupa.com Forums. Just post your question and I, or our friendly forum helpers, will help answer it.

The following is a list of related tutorial and help resources that you may find useful:

How to use the Forums
New, Upcoming, and In-Progress Tutorials
How to Help out kirupa.com
Writing Tutorials
 
Cheers!
Kirupa Chinnathambi
kirupaBlog

 


kirupa.com's fast and reliable hosting provided by Media Temple. flash components
The Text Animation Component for Flash CS3
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.
Check out our high quality vector-based design packs! Flash Effect Components
flash menus, buttons and components Digicrafts Components
The best flash components ever! Entheos Flash Website Templates
Buy and sell FLAs at Ultrashock! Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com
Purchase & Download Flash Components flash components
Learn how to advertise on kirupa.com