Specifications
60 Basic Tasks: Creating a banner, Part 2
Before you add the code, you need to give the button a unique instance 
name. The instance name enables you to target the button with 
ActionScript code. If you don't name the button, your code doesn't have a 
way of targeting the button from the timeline. The first step is to assign the 
invisible button an instance name, and then you add code that targets that 
button using its name.
1. Select the invisible button on the Stage. 
2. Open the Property inspector (Window > Properties), and find the 
Instance Name text box in the Property inspector. 
3. Type inv_btn into the Instance Name text box.
4. Select Insert > Timeline > Layer to insert a new layer, and then rename 
the new layer to actions. 
5. Open the Actions panel (Window > Actions), and then select Frame 1 
of the actions layer. 
6. Type the following ActionScript into the script pane (the editable text 
field) in the Actions panel:
inv_btn.onRelease = function(){
 getURL("http://gnome.deseloper.com", "_blank");
};
Notice how you target the inv_btn instance in the first line of code. 
The event is the 
onRelease event in your ActionScript code, which 
refers to the action when a user clicks and then releases the mouse over 
the 
inv_btn instance. Then you tell the button to open a particular 
web page (http://gnome.deseloper.com) in a new window (
_blank) 
using the 
getURL() method. Obviously, you would replace this URL 
with whatever website you want the banner to open. If you want the 
banner to open the website in the current page, replace 
_blank with 
_self. 
This is a simple piece of ActionScript code that reacts to a button click. 
There is a lot of additional information on learning the ActionScript 
language in the Flash 8 documentation. Refer to the documentation's 
Table of Contents, and find Learning ActionScript 2.0 in Flash.
NOTE
 An instance name is different from the symbols name (which is what you 
type in the Name text box in the Convert to Symbol dialog box). An 
instance name cannot have spaces or special characters, but you can use 
underscores. Also, your instance names are case-sensitive.










