MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH Spezifikationen Seite 129

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 152
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 128
Add ActionScript code 129
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"+currImage+"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"+currImage+"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_Getting_Started.book Page 129 Friday, September 2, 2005 12:22 PM
Seitenansicht 128
1 2 ... 124 125 126 127 128 129 130 131 132 133 134 ... 151 152

Kommentare zu diesen Handbüchern

Keine Kommentare