5 Replies Latest reply on Aug 8, 2007 10:33 AM by pixelone

    DateChooser

    pixelone
      Does anybody know how to get the DateChooser in Flex to read from an XML file containing all my events for a particular date. Seems no body has a clue.. I'm so tired of looking. Can anybody help me. I am new to flex, but I like the calendar function, it simple and it's 50% completed. I just need to know how to get my data connected to it..
      Thanks to anyone who cna help.........

        • 1. Re: DateChooser
          batmitra Level 1
          hi
          i don't know if i've got the picture of what you want but i think you want to click on a date on the control and have it show your events for that day. If that's the case, all you have to do is have a function called when the user selects a date and that function should read your xml having date choosed as a parameter.

          you can see an example of how to work with DateChooser control here:

          http://livedocs.adobe.com/flex/2/langref/mx/controls/DateChooser.html#event:change
          • 2. Re: DateChooser
            pixelone Level 1
            batmitra, that's exactly what I'm trying to do. Thank you.

            <mx:Script>
            <![CDATA[

            // Event handler function to write the selected
            // date to the Label control.
            private function displayDate(date:Date):void {
            if (date == null)
            selection.text = "Date selected: ";
            else
            selection.text = "Date selected: " + date.getFullYear().toString() +
            '/' + (date.getMonth()+1).toString() + '/' + date.getDate();
            }
            ]]>
            </mx:Script>

            Would I put the code within this script to load the information in from my XML files? Could you proide me an example please. I.E Say you click on Aug 17th, 2007 it loads The name of the event, date, etc.. just show me an idea of what the source or function would look like.. Thank you soo soo much
            • 3. Re: DateChooser
              batmitra Level 1
              hi
              yes you will put your code inside that function , i don't have an example here but i'll try to give one as soon as possible
              • 4. Re: DateChooser
                batmitra Level 1
                hi again, here is an example:

                <mx:application>

                <mx:Script>
                <![CDATA[

                // Event handler function to write the selected
                // date to the Label control.
                private function displayDate(date:Date):void {
                if (date == null)
                selection.text = "Date selected: ";
                else
                selection.text = "Date selected: " + date.getFullYear().toString() +
                '/' + (date.getMonth()+1).toString() + '/' + date.getDate();

                Alert.show(myxml.myevent.@date=date.selection.text);
                }
                ]]>
                </mx:Script>
                <mx:XML id="myxml">
                <agenda>
                <myevent date="17/08/2007" Task="Programming Flex" ></myevent>
                <myevent date= "18/08/2007" Task="Deliver Flex Application"></myevent>
                </agenda>
                </mx:XML>


                </mx:application>

                this should do it, don't forget to point to this function o n change event of the datechooser.

                • 5. Re: DateChooser
                  pixelone Level 1
                  Thank you so so much. You've been a major help. Thanks again. May all great things come your way..