Monday, 16 June 2008

Display date

This flash tutorial will teach you how to display the full date. This tutorial uses Actionscript 2.0, and Arrays to display the day. This is very similar to the display time tutorial.

UPDATE: new Actionscript 3.0 version now available here.

Display date

Step 1

Create a new Flash document.
Select the Text tool with dynamic text drag a rectangle text field on the stage like below. Make sure your text field is large enough to hold your displayed date.

Step 2

Using the Selection tool (v) select the dynamic text field. 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",
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.

  COPYRIGHT © 2014 · ILIKE2FLASH · Theme by Ourblogtemplates

Back to TOP