Flash Tutorials, Samples, Resources, Greetings, Games
Home | About Us | Resources | Tutorials | Links | Games | Movies | Projects | Feedback | Contact Us
Tutorials
Here you'll get tutorials for all skill levels wheather you are a new user or an expert flash developer.

» Enter
Resources
In this section you'll get some small movie clips which can be used in your flash projects with flash components, flash action scripts .as files and some other stuff that will help you in your flash projects. You can also submit your work here. For submit details please checkout our Submit Page.

» Enter
Games
Play and download great flash games. If you have any flash game, please send us, we will put it with your name.

» Enter
Movies
Flash FLA movies to download.

» Enter
Home » Tutorials



   Basic Level - Getting time in Flash
First of all create a new fla file save it with the name time.fla
Select first frame and open the script window and write the following code:-

mydate = new Date();
hours = mydate.getHours();
minutes = mydate.getMinutes();
seconds = mydate.getSeconds();
dtformat = hours + ":" + minutes + ":" + seconds;

We have stored today's date in a variable named "dtformat" and so we have to insert a text box on stage and set its porperties to dynamic and give it variable name "dtformat".


Now test your movie by pressing Ctrl+Enter and Voila you have done it. But here you will see that the date is displayed and not changing. For this you have to refreash the movie so that it will retrieve time again and again and you got a running time. So for this, again go to your movie, select first frame and insert a keyframe by pressing F6. and write this code on second frame :-

gotoAndPlay(1);

Again test your movie by pressing Ctrl+Enter, and now you will see a running time.


Download Final Fla file