Search tutorials
The previous page didn't stisfied you, eh? Ok, now we will make days, months, and years.
1. Edit a movie clip, and add a second dynamic text to it. Give it instance name of 'czas2'.
2. Now delete all code from your movie clip and paste this:
3. Code between last 3 lines and 'tydzien2="sat";' tells about time of year and time of day, wich we will learn about at next page.
4. Save, and test. It's working ^^!
5. To change form of display of time or date, edit lasy 3 lines of code for example :
it will look like this. If you have hour 20:15:30, then your clock will display it like this: 20hrs 30secs 15mins
Possible changes are infinite!
6.To prevent Accident(tm), just save your work and test it (file/publish preview/flash)
1. Edit a movie clip, and add a second dynamic text to it. Give it instance name of 'czas2'.
2. Now delete all code from your movie clip and paste this:
onClipEvent (enterFrame) {
data = new Date();
rok = data.getFullYear();
miesiac = data.getMonth();
tydzien = data.getDay();
dzien = data.getDate();
godziny = data.getHours();
minuty = data.getMinutes();
sekundy = data.getSeconds();
milisekundy = data.getMilliseconds();
if (sekundy<10) {
sekundy = "0"+sekundy;
}
if (minuty<10) {
minuty = "0"+minuty;
}
if (godziny<10) {
godziny = "0"+godziny;
}
if (dzien<10) {
dzien = "0"+dzien;
}
if (miesiac == 0) {
miesiac2 = "Jan";
}
if (miesiac == 1) {
miesiac2 = "Feb";
}
if (miesiac == 2) {
miesiac2 = "Mar";
}
if (miesiac == 3) {
miesiac2 = "Apr";
}
if (miesiac == 4) {
miesiac2 = "May";
}
if (miesiac == 5) {
miesiac2 = "Jun";
}
if (miesiac == 6) {
miesiac2 = "Jul";
}
if (miesiac == 7) {
miesiac2 = "Aug";
}
if (miesiac == 8) {
miesiac2 = "Sep";
}
if (miesiac == 9) {
miesiac2 = "Oct";
}
if (miesiac == 10) {
miesiac2 = "Nov";
}
if (miesiac == 11) {
miesiac2 = "Dec";
}
if (tydzien == 0) {
tydzien2 = "Sun";
}
if (tydzien == 1) {
tydzien2 = "Mon";
}
if (tydzien == 2) {
tydzien2 = "Tue";
}
if (tydzien == 3) {
tydzien2 = "Wen";
}
if (tydzien == 4) {
tydzien2 = "Thu";
}
if (tydzien == 5) {
tydzien2 = "Fri";
}
if (tydzien == 6) {
tydzien2 = "Sat";
}
if (miesiac == 11 or miesiac == 0 or miesiac == 1) {
_root.pora.gotoAndPlay("zima");
}
if (miesiac == 2 or miesiac == 3 or miesiac == 4) {
_root.pora.gotoAndPlay("wiosna");
}
if (miesiac == 5 or miesiac == 6 or miesiac == 7) {
_root.pora.gotoAndPlay("lato");
}
if (miesiac == 8 or miesiac == 9 or miesiac == 10) {
_root.pora.gotoAndPlay("jesien");
}
if (godziny != 0) {
_root.pora2.gotoAndPlay(godziny);
} else {
_root.pora2.gotoAndPlay(25);
}
czas = godziny+" : "+minuty+" : "+sekundy;
czas2 = "A.D. "+rok+" "+tydzien2+" "+dzien+" "+miesiac2;
}
3. Code between last 3 lines and 'tydzien2="sat";' tells about time of year and time of day, wich we will learn about at next page.
4. Save, and test. It's working ^^!
5. To change form of display of time or date, edit lasy 3 lines of code for example :
czas= godziny+"hrs "+sekundy+"secs "+minuty+"mins";
it will look like this. If you have hour 20:15:30, then your clock will display it like this: 20hrs 30secs 15mins
Possible changes are infinite!
6.To prevent Accident(tm), just save your work and test it (file/publish preview/flash)
| » Level Intermediate |
|
Added: 2005-11-09 Rating: 5 Votes: 6 |
| » Author |
| Ehhh, lol? :P I love pizza and hentai :P |
| » Download |
| Download the files used in this tutorial. |
| Download (0 kb) |
| » Forums |
| More help? Search our boards for quick answers! |
-
You must have javascript enabled in order to post comments.


Comments
There are no comments yet. Be the first to comment!