
248 Tutorial: Building Your First Flash Application
image0uri
contains a string that is the Universal Resource Identifier for
the image file that is loaded and displayed in each section of the
slides
movie clip.
The next two lines of code declare two more variables:
var currImage:Number = 0;
var totalImages:Number = 4;
The first variable,
currImage
, stores the number of the current image that
is being displayed in the
slides
movie clip. The second variable,
totalImages
, stores the total number of images that are available to be
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
slideShow
movie clip in that case.
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"+cu"title"];
This code uses dot syntax to set the text property of the title_txt text box in
the
menu_mc
movie clip instance to the value of a variable. In this case the
variable name is constructed from the word image plus the value of the
currImage
variable, plus the word
title
. The variable name becomes
image0title
or one of the other similar variable names, depending on the
number contained in the
currImage
variable. The word
this
indicates to
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"+cu"desc"];
This line of code sets the text of the description text box in the
menu_mc
movie clip instance to the text in the
desc
variable that corresponds to the
current image number.
The following lines of code set up a
for
loop to load external JPG image
files into the
holder
movie clip instances, which are in the
slides
movie
clip in the
slideShow
movie clip. The file paths to each external JPG file
are stored in the
image*uri
variables declared in the beginning of this
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());
}
000_ExploringStudio.book Page 248 Tuesday, August 30, 2005 9:30 AM
Summary of Contents for STUDIO 8-EXPLORING STUDIO 8
Page 1: ...Exploring Studio 8...
Page 8: ......
Page 42: ...42 Learning Studio...
Page 134: ...134 Web Development Workflow...
Page 136: ......
Page 162: ...162 Tutorial Creating Page Mock ups...
Page 182: ......
Page 194: ...194 Tutorial Handling Photographs...
Page 254: ...254 Tutorial Building Your First Flash Application...
Page 266: ...266 Tutorial Building a Video Player Flash Professional only...
Page 268: ......
Page 294: ...294 Tutorial Adding Content to Pages...
Page 324: ...324 Tutorial Formatting Your Page with CSS...
Page 332: ...332 Tutorial Publishing Your Site...
Page 342: ...342 Tutorial Setting Up Your Website for Contribute Users...
Page 350: ...350 Index...