MACROMEDIA FLASH 8-GETTING STARTED WITH FLASH Getting Started page 129

Table of Contents

Advertisement

image0uri
contains a string that is the Universal Resource Identifier for
the image file that is loaded and displayed in each section of the
movie clip.
The next two lines of code declare two more variables:
var currImage:Number = 0;
var totalImages:Number = 4;
The first variable,
currImage
is being displayed in the
, stores the total number of images that are available to be
totalImages
displayed. By storing this last number in a variable, you make it easier to
change the number if you want to add more images to the slide show later.
You would also need to modify the
The next line of code sets the text of the title text box to the text in the
variable whose name corresponds to the current image number.
menu_mc.title_txt.text = this["image"+currImage+"title"];
This code uses dot syntax to set the text property of the title_txt text box in
the
movie clip instance to the value of a variable. In this case the
menu_mc
variable name is constructed from the word image plus the value of the
variable, plus the word title. The variable name becomes
currImage
or one of the other similar variable names, depending on the
image0title
number contained in the
Flash that the variable was declared inside this same script.
The following line of code is similar to the previous one:
menu_mc.description_txt.text =
this["image"+currImage+"desc"];
This line of code sets the text of the description text box in the
movie clip instance to the text in the
current image number.
The following lines of code set up a
files into the
movie clip instances, which are in the
holder
clip in the
slideShow
are stored in the
image*uri
ActionScript code block, as follows:
for (var i:Number = 0; i<totalImages; i++) {
slideShow_mc.slides_mc["holder"+i].loadMovie(this["image"+(i
)+"uri"],slideShow_mc.slides_mc.getNextHighestDepth());
}
, stores the number of the current image that
movie clip. The second variable,
slides
slideShow
variable. The word this indicates to
currImage
variable that corresponds to the
desc
loop to load external JPG image
for
movie clip. The file paths to each external JPG file
variables declared in the beginning of this
slides
movie clip in that case.
menu_mc
movie
slides
Add ActionScript code 129

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

This manual is also suitable for:

Flash 8

Table of Contents