Display date
Step 1
Create a new flash document.
Using the dynamic text tool drag a rectangle shape on the stage like below:
Step 2
Using the selecting tool (v) select the dynamic text box. And then give it a variable name. eg. theDate.
Step 3
Convert the dynamic text box into a symbol by selecting F8, choose an appropriate name, check movie clip and click ok.
Step 4
Now right click on your movie clip and select actions.
Add the following code:
onClipEvent (load){
weekdays = ["Sunday","Monday","Tuesday",
"Wednesday","Thursday","Friday","Saturday"];
months = ["Jan","Feb","Mar","Apr","May","Jun","Jul",
"Aug", "Sep", "Oct","Nov","Dec"];
}
onClipEvent (enterFrame){
myDate = new Date();
tDay = weekdays[myDate.getDay()];
tMonth = months[myDate.getMonth()];
tDate = myDate.getDate();
tYear = myDate.getFullYear();
theDate = tDay+", "+ tMonth+" "+tDate+", "+tYear;
}
Step 5
Test you movie clip ctrl + enter.
You should now have a date display.





0 comments:
Post a Comment