MACROMEDIA FLASH 8-FLASH Tutorials Manual page 60

Hide thumbs Also See for FLASH 8-FLASH:
Table of Contents

Advertisement

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.
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.
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
The event is the
onRelease
refers to the action when a user clicks and then releases the mouse over
the
instance. Then you tell the button to open a particular
inv_btn
web page (http://gnome.deseloper.com) in a new window (
using the
getURL()
with whatever website you want the banner to open. If you want the
banner to open the website in the current page, replace
.
_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.
instance in the first line of code.
inv_btn
event in your ActionScript code, which
method. Obviously, you would replace this URL
)
_blank
with
_blank

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-FLASH and is the answer not in the manual?

Table of Contents

Save PDF