1 Reply Latest reply on Sep 11, 2009 12:56 AM by bluecuraga47

    Can't access selected dates in dateChooser

    bluecuraga47

      This is my code in a flex/air applicaiton for the datechooser:

       

       

       

       

       

       

       

       

       

       

       

       

       

      <mx:DateChooser

       

      x="13" y="12" width="221" height="187" allowMultipleSelection="true" change="dateChooser_change(event)" id="dateChooserBox" />

       

       

       

       

      This is what I'm using to try to extract the chosen dates:

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

      trace

       

       

      ("trace"+dateChooserBox.selectedRanges[i]);

       

       

       

       

       

      trace("trace as string"+dateChooserBox.selectedRanges[i].toString());

       

       

       

       

       

       

      Output:

       

       

      trace[object Object]

      trace as string[object Object]

       

       

      How do I get the date instead of "object Object"? I'm trying to extract the date so I can put it back into an sqllite query. This has been giving me a lot of headaches. I tried getTime, getMonth and those produced errors too.

        • 1. Re: Can't access selected dates in dateChooser
          Andrew Rosewarn Level 3

          HI there

           

          The date are stored in properties called rangeStart and rangeEnd

           

          <?xml version="1.0"?>

          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"   xmlns:ns1="*">

           

          <mx:Script>

          <![CDATA[

          import mx.events.DateChooserEvent;

           

          private function dateChooser_change(event:Event):void {

          for each ( var item:Object in  dateChooserBox.selectedRanges) {

          trace (item.rangeStart + ' : ' +item.rangeEnd);

          }

           

          }

          ]]>

          </mx:Script>

           

          <mx:DateChooser x="13" y="12" width="221" height="187" allowMultipleSelection="true" change="dateChooser_change(event)" id="dateChooserBox" />

          </mx:Application>

           

          Hope this helps.

           

          Andrew