Graphics Programs Reference
In-Depth Information
The next section of the script functions as an initialization for the opening screen. Since
some of the flags can become quite large and cover the title and instructions, it was
decided that the text should always be seen. In order to do this, we just need to place
the text on a layer higher than any of the flags. Line 74 uses swapDepths(32000) ,
which more than gets the job done, since the z-values for the flags have a maximum
value of 1800 from lines 30 and 39.
Line 75 makes sure that the message for the selected flag country is not seen initially
by setting its visibility to false.
The remaining part of this section creates an array of the names of the flag countries.
The names are listed in the same order that the flags are loaded into the scene. Note
that the first item in the array is an empty name. This was done for convenience since
the flags are numbered 1-24 but the index of arrays begins at 0, so the elements would
otherwise be numbered 0-23. At times, lazy designers who like to count on their fin-
gers grow weary of this difference and find it easier to simply add a blank entry. The
flag names are entered in the code here for clarity but could just as easily be loaded
dynamically into flagArray .
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// -----------------------------------------------------------
// set up the opening screen and flag names
title_mc.swapDepths(32000); // put the title on top
title_mc.flag_txt._visible = false; // turn off the flag text
// define the array of flag countries
flagArray = ["","United Kingdom","Turkey","Spain","Slovenia",
"Slovakia","Romania", "Portugal","Poland"
"Norway","Netherlands","Luxembourg","Lithuania",
"Latvia","Italy","Ireland","Hungary",
"Greece","Germany","France","Estonia",
"Denmark","Czech Republic","Bulgaria","Belgium"]
The next section of the script deals with defining the user interaction. There are three
ways in which the user can interact with this project. The most important is the user
clicking on a flag. Here's what we want to have happen. We need to identify which flag
has been selected so that the name of the corresponding country can be displayed. We
would also like to move the viewer toward the selected flag.
 
Search WWH ::




Custom Search