Actions – Using textspace as clock


dot Start a new empty movie.

dot Click on size-button.

Background properties

dot Set Size to 200 px (width) x 100 px (height).

dot Set Background Color to your own background color.

Step by step

dot Select the text tool.

Select the text tool

dot Begin by drawing a textspace.

Drawing a textspace

dot In properties, set the following parameters :

Text tool properties


dot The most important parameters you have to adapt are :

    - Sort of text : choose Dynamic Text because the text (time) has to be
      able to change.

    - The variable in the textspace : you can call that time
      (attention: you will use that later in the action where you will make a
      reference to it)

    - As font choose one where all letters (and figures) are of equal size,
      otherwise your time will jump slightly to left or right later on.
      Trebuchet MS is a good example for this, or if you don’t have that
      one, you can also choose Courier New.

dot In the timeline add after keyframe 1 another frame (by clicking on F5)
    so the movies starts running and our time changes.

Timeline


Top of Page


dot Add the the first frame the following actions. You do this by selecting
    the first frame and opening the action window by pressing F9.
    Copy the following text :

Actions Frame

datum = new date;
uur = datum.gethours();
minuten = datum.getminutes();
if (minuten<10) {
minuten = "0"+minuten;
}
seconden = datum.getseconds();
if (seconden<10) {
seconden = "0"+seconden;
}
time = uur+":"+minuten+":"+seconden;



Top of Page

dot Explanation : In the first line you create a variable (a piece of memory)
    where the date is set. Then you create a variable called hour, where you
    set the hours in that date. The same goes for minutes and seconds, but
    there you’ll add a 0 if they are smaller than 10 (so the time is always of
    equal length). So in the end you will get a date, composed of hours,
    minutes and seconds, each divided by a double point.

dot If desired you can choose a dark background Ctrl+J and change the
    text-color. You can view the result by pressing Crtl+ENTER.


This is a tutorial for Macromedia® Flash MX®.
Macromedia and HomeSite are trademarks or registered trademarks of
Macromedia, Inc. in the United States and/or other countries.

© Tim Beylemans. All rights reserved.



Previous page ~ Top of Page