Actions – Using textspace as clock
Start a new empty movie. Click on size-button. |
|
Set Size to 200 px (width) x 100 px (height). Set Background Color to your own background color. |
Step by step |
Select the text tool. |
|
Begin by drawing a textspace. |
|
In properties, set the following parameters : |
|
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. |
In the timeline add after keyframe 1 another frame (by clicking on F5) so the movies starts running and our time changes. |
|
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 : |
|
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; |
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. |
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.