Using Date Objects in Flash Form (Issue)

Posted on Oct 18, 2005

A coworker of mine brought this issue to my attention. In my tests, you cannot modify a date object created using ActionScript in a Flash form. In his attempts and mine as well, no matter how we manipulate a date, it always comes back with the current date/time. For example:

<cfform format="flash" name="form1" onload="{setItem();}">
   <cfformitem type="script">
      function setItem() {
         var theDate:Date = Date(2004,9,1);
         alert(theDate.toString());
         theDate.setFullYear(1974,7,16);
         alert(theDate.toString());
      }
   </cfformitem>
</cfform>

The first alert will show today's date/time and the second exactly the same. I also tried other methods listed under the date class with the same effect. Perhaps it is because Flash forms disallow the new keyword? Anyone run into this issue? Anyone have a solution?

Comments

Richard It's gotta be something with &quot;new&quot;. I'm just trying it in Flash, but if I change your first line to var theDate:Date = new Date(2004,9,1) it works.

Posted By Richard / Posted on 10/18/2005 at 4:11 PM


Write your comment



(it will not be displayed)





About

My name is Brian Rinaldi and I am the Web Community Manager for Flash Platform at Adobe. I am a regular blogger, speaker and author. I also founded RIA Unleashed conference in Boston. The views expressed on this site are my own & not those of my employer.