PDA

View Full Version : TIME DATE please help



COVERFIRE
September 7th, 2003, 07:41 PM
Okay, I've tried to follow the tutorial on this site for the digital clock but I still can't get it. All I want is a simple dynamic text box that says "DayOfWeek, Month, Date". I have Flash MX. Please help because I've done everything the tutorial says with no luck.

Jack_Knife
September 8th, 2003, 03:48 AM
I didn't know what you meant by date so I just put the day of the week. Post if you don't understand it, or it doesn't work.



dayArray = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
monthArray = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "July", "Aug", "Sep", "Oct", "Nov", "Dec");
myDate = new Date();
dayOfWeek = myDate.getDay();
month = myDate.getMonth();
dateNum = myDate.getDate();
dynamicText = dayArray[dayOfWeek] add ", " add monthArray[month] add ", " add dateNum;

[m]
September 8th, 2003, 08:33 AM
Never use add, it's flash 4 syntax. Use + instead.


(and a little smaller ;))


dynamicText = (["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"])[(new Date()).getDay()] + ", " + (["Jan", "Feb", "Mar", "Apr", "May", "Jun", "July", "Aug", "Sep", "Oct", "Nov", "Dec"])[(new Date()).getMonth()]
+ ", " + (new Date()).getDate();

Jack_Knife
September 9th, 2003, 03:16 AM
meh, it just seems to work better sometimes, probably cause I try to use & alot, anyway thanks.