ahref.com > Guides > Design
Macromedia Flash Tutorial, Part II, Continued
Finishing Up
To get the time from the
computer, we'll use three built-in JavaScript Methods: getSeconds, getMinutes
and getHours. The seconds and minutes are manipulated in JavaScript to
provide a separate tens (0-5) and units (0-9) digit for the seconds and
minutes, and the hours are sent to the Hours Movie Clip in 24-hour
format (0-23). For the seconds digit we use the following
Flash Method in JavaScript to send a command for the correct
information to Flash for immediate display.
jc().TGotoLabel('_level0/Clock/1Second', S1);
The function jc() is used to supply the correct object model, which is
different for Internet Explorer than for Netscape. We use the Flash Method
TGotoLabel(target,label), where target is the same type of Target used
in Tell Targets in Flash and label is the Label given to a frame in
Flash 3. The _level0 (underline level zero) in the target refers to the
main Flash movie on level zero.
Similar to the hierarchy of files and directories, Flash has a hierarchy
of timelines. To specify targets at different levels in the hierarchy,
add a path to the target name using the same system as file paths or
URLs. The main timeline is the top level and Movie clips on it are
children of that timeline. Movie Clips inside other Movie Clips are
called nested. In our example Movie Clip '1Second' is a child of Movie
Clip 'Clock' on the main timeline in the Movie on level zero (hence /Clock/1Second). S1 is the
JavaScript variable that shows seconds.
John Croteau (croteau@erols.com), a recognized expert in Flash creation, has been involved in Flash since the release of the beta for Flash 2. His Flash Tech Resource (http://www.FlashCentral.com/Tech/), now a
part of Flash Central, is a useful technical information resource for Flash developers.
|