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

Table of Contents

Advertisement

130 Tutorial: Building Your First Flash Application
A
loop is a block of code surrounded by a set of braces { } that repeats
for
for each increment of the
because the value of
totalImages
used to load a Flash file or an image file into the movie clip. In this case it is
loading the external JPG files.
The next line of code loads the first image, stored in the
variable, into the
holder4
slideShow_mc.slides_mc["holder4"].loadMovie(this["image0uri"
],slideShow_mc.slides_mc.getNextHighestDepth());
The following lines of code implement the functionality of the Next
button:
function nextMenuItem(eventObj:Object) {
slideShow_mc.gotoAndPlay("slide"+(currImage));
if ((currImage+1)>=totalImages) {
currImage = 0;
} else {
currImage++;
}
menu_mc.title_txt.text =
this._parent["image"+currImage+"title"];
menu_mc.description_txt.text =
this._parent["image"+currImage+"desc"];
}
The code for the Next button is contained in the
A function is a block of code that is set up to execute when a particular
event occurs. In this case, the function will run whenever the user releases
the mouse button over the Next button on the Stage.
Inside the function is the
playhead to jump to a specific frame label in the Timeline. The Frame label
specified in this case is constructed from the word slide and the current
value of the
currImage
The next line contains an
variable plus 1 is equal to the value of the
currImage
variable. If this is true, the code sets the value of
the code increments the value of
The last two lines in the function set the text of the title and description
text boxes to the strings stored in the
variables that correspond to the value of the
variable. In this case,
i
is 4. The
loadMovie()
movie clip instance, as follows:
method, which directs the
gotoAndPlay()
variable.
statement that checks to see if the value of the
if
by 1.
currImage
image*title
currImage
increments from 0 to 4
i
method can be
image0uri
function.
nextMenuItem
totalImages
to 0, otherwise
currImage
and
image*desc
variable.

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?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents