Lingo 4.0 Tutorial: Globals READING: Manual pages of the commands described here Take a look at and download the starting file "PresidentialRace0.dir" and the Piano audio file. The aim is to create the behavior in the final "PresidentialRace2.dir" file. File "PresidentialRace1.dir"Shows
the use of global variables: That's how different scripts
are communicating. A
variable's environment is the current execution of the
handler it is used in (the area between the keywords on and end). So,
by default, Director's variables are local variables. That's
not very useful. In
the sample file, you need to keep two global variables,
one for each presidential candidate. Count the votes and
report
the results. Note that also you can change the
contents of any
field through scripting ( member(9).text
= "This and that"). What happens in the case of a tie between the presidential
candidates? Why? Note that the background music stops after a while. How would you make it keep playing? How would you make it loop smoothly? File "PresidentialRace2.dir"To become even more interesting, in this file there is some visual feedback when you roll the mouse over a candidate. Makes use of mouseEnter and mouseLeave. When the mouse enters a sprite (that is, a channel), the cast member changes to a new one ( sprite(2).member = "Arthur2" ). Note that the cast members have been named in a meaningful way. We argue that it is better to use the names of cast members instead of their numbers in the cast library that bounds them to a particular location. Compare the sizes of the two movies - why such a difference? Here
is another way to use sound: Smooth music is
playing using
|
|
Maintained By: Takis Metaxas
|