I have this code on my MC. I just want to know if what i’m getting is correct. I have this to get the date, day, month, year…you know the drill, but i can only get the complete date to display if I use onClipEvent(load)…(enterFrame) won’t work, and i just wanted to make sure there was a reason behind it. Is it because I’m using arrays? check out the code. I do not want to majorly change the code if it can be avoided…\r\ronClipEvent (load){\rmon = [“Jan”,“Feb”,“Mar”,“Apr”,“May”,“Jun”,“Jul”,“Aug”,“Oct”,“Nov”,“Dec”];\rweekdays = [“Sunday”,“Monday”,“Tuesday”,“Wednesday”,“Thursday”,“Friday”,“Saturday”];\rnow = new Date()\rday = weekdays[now.getDay()]\rmonth = mon[now.getMonth()]\rdate = now.getDate()\ryear = now.getFullYear()\rdisplayDate = month+" “+date+”, "+year\rdisplayDay = day\r}
No idea. I don’t understand, here it says ’ ’ ’ ’ after the time.\rpom 0]
well this code works for me. But if I put enterFrame it doens’t work…i was just wondering.
I tried to do it on press, it works the same. Strange strange. Maybe a little bug ??\r\rpom 0]
when you say:\r\rdate = now.getDate()\r\ryou’re overwriting the Date Object. then then next time you go\r\rnow = new Date();\r\rit doesn’t work.\r\rit’s not that it won’t work in an onClipEvent(enterFrame), it’s that it won’t work more than once.\r\ryou should really use two events here. use the load event for things that only need happen once:
\r\ronClipEvent(load){\r\r mon = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Oct","Nov","Dec"];\r\r weekdays = ["Sun","Mon","Tues","Wed","Thu","Fri","Sat"];\r\r now = new Date();\r\r}
\rand an enterFrame event for the stuff that needs to be continously updated:
\r\ronClipEvent(enterFrame){\r\r day = weekdays[now.getDay()];\r\r month = mon[now.getMonth()];\r\r mdate = now.getDate();\r\r year = now.getFullYear();\r\r displayDate = month+" "+mdate+", "+year;\r\r displayDay = day;\r\r}
\rnote that i’ve changed the variable date to mdate.\r\rmind you, this info only needs to update every 24 hours so your probably safe just putting the whole thing in a load event. ; )
yeah i was thinking about that, because no one is really going to be looking at the site for a whole day, or at least while it is switching over, but I don’t want the code to be wrong. Thanks for spotting the variable. I knew it was something minor.
Supra, good to see you.\rI was wondering : What do you mean by overwriting the Date Object ??\r\rpom 0]
where it says \r\rnow = new Date()\r\rthen i used \r\rdate = now.getDate()\r\ri’m pretty sure that it just causes a conflict within the code.
Oh, I see. Thanks.\rpom 0]