Web
Article

Flash Script – Dynamic Time in Flash

By Georgina Laidlaw


Download the sample files here.

1. Create a new movie with width=200 and height=75.

2. Create a text field, and name it "time".

3. Name the current layer "textfield".

4. Create a new layer above the current layer, and name it "actions".

4. Create two key frames in the actions layer.

5. Insert this action into the first key frame:

today = new Date();  

time = today.getHours() add ":" add today.getMinutes()  
add ":" add today.getSeconds();

6. In the second frame, insert this action:

gotoAndPlay (1); 

7. You're finished! Press ctrl+enter to test the movie.

Meet the author
Georgina has more than fifteen years' experience writing and editing for web, print and voice. With a background in marketing and a passion for words, the time Georgina spent with companies like Sausage Software and sitepoint.com cemented her lasting interest in the media, persuasion, and communications culture.

No Reader comments

Recommended

Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Get the latest in Front-end, once a week, for free.