Add Actionscript Code - MACROMEDIA STUDIO 8-EXPLORING STUDIO 8 Manual

Table of Contents

Advertisement

To add the text (in
quotes),
ActionScript refers
to the text boxes by
noting the name of
the menu movie clip
instance that is on
the Stage
(menu_mc), and then
the name of the text
box itself within the
movie clip instance,
as follows:
menu_mc.description
This syntax is called
dot syntax. It is used
throughout
ActionScript to refer
to objects that are
nested within other
objects.
244 Tutorial: Building Your First Flash Application

Add ActionScript code

You have now added all the graphic and text elements that your FMA
requires. The last step is to add the ActionScript code that displays the
proper text and image for each slide in the
If you did not complete Chapter 7, "Tutorial: Handling Photographs" you
need get the images required for this tutorial. To do so, open the
cafe_townsend/completed_files/flash/images folder that you copied to
your hard disk in Chapter 4, "Tutorial: Setting Up Your Site and Project
Files," and then copy the image0.jpg, image1.jpg, image2.jpg, and
image3.jpg files to the cafe_townsend/images folder.
Test an ActionScript sample
First, you'll add some simple ActionScript code to see it work.
To add the test ActionScript:
1.
In the Timeline, click the layer name actions to activate that layer.
2.
Select Window > Actions to open the Actions panel.
3.
In the Actions panel, type the following ActionScript code. You can
copy and paste the following code from the Flash Help panel:
function testFunc(eventObj:Object) {
menu_mc.title_txt.text = "Testing the title";
menu_mc.description_txt.text = "Testing the
description";
}
// add the event listener for the button
next_btn.addEventListener("click", testFunc);
This ActionScript code adds some text to the title and description text
boxes that you added to the
4.
Select Control > Test Movie.
The Flash document opens and plays in a new window.
5.
In the Test Movie window, click Next.
The test title and test description text you entered as part of the
ActionScript code appears in the blue rectangle on the right side of the
document.
6.
Save your document.
slideShow
movie clip earlier.
menu
movie clip.

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

This manual is also suitable for:

Studio 8

Table of Contents