4 Replies Latest reply on Feb 26, 2010 11:06 AM by agorman_co

    Is it Possible to Use MouseOver in DateChooser?

    alice_data Level 1
      Hi, Guys:

      I am trying to create dynamic toolTips of event labels on a dateChooser. However, as I am working on this problem, I have run into a problem. I cannot seem to get the mouseOver or mouseOut function to work and have it provide me with the date I have just rolled over or out.

      Instead, I get this error from the code I have provided: TypeError: Error #1009: Cannot access a property or method of a null object reference.

      If I use event.currentTarget only, I only get the id value of my DateChooser, which is date1. Could anyone please give me some tips on what I have done wrong here?

      Thanks for your help.
      Alice
        • 1. Re: Is it Possible to Use MouseOver in DateChooser?
          LPVOID32
          Hi
          the default value for "selectedDate" is null you can initialize it in the creation Complete event:
          date1.selectedDate = new Date();
          and selectedDate will change after you click a valid day , i.e after click event not mouse over event.
          • 2. Re: Is it Possible to Use MouseOver in DateChooser?
            alice_data Level 1
            Yeah, I do know about the null value of the selectedDate when you use it as a click event.
            The problem is, even if I tried to mouseOver and have it echo back the name of the event is never the name of the date, but looks like the position name of the object array. I have attached the code below, and I get the event.target.name.toString output something like the following:

            UITextField54
            UITextField48

            If I try to have it trace the line trace("On Over: " + event.target.selectedDate.getDay()); I get the error in the following when I try to debug it:

            ReferenceError: Error #1069: Property selectedDate not found on mx.core.UITextField and there is no default value.

            Do I have to define the dates' position one by one? Or, is there something a little easier?

            Thanks for your help.
            • 3. Re: Is it Possible to Use MouseOver in DateChooser?
              alice_data Level 1

              Hi,

               

                 Here is my updated code:

               

              <?xml version="1.0" encoding="utf-8"?>
              <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" themeColor="#0EFF02">
                 <mx:Script>

               

                     <![CDATA[
                         import mx.core.UITextField;
                         import mx.core.UIComponent;
                         import mx.controls.Alert;
                    
                         private function useDate2(event:MouseEvent):void
                      {

                         if(event.target is UITextField)
                        trace(event.target.text);
                               
                    }

               

                     ]]>
                 </mx:Script>
               
                 <mx:Canvas id="test"  x="118" y="136" width="443" height="173" >
                 <mx:DateChooser id="date1"
                    mouseOver="useDate2(event)"
                     backgroundColor="#FFFFFF" />
                 </mx:Canvas>
              </mx:Application>

               

              Looks like I did figure out how to get the mouseOver to work in this situation, but I could not get it to pull the entire date string. Right now, this snippet shows that I could extract the day of the week, month, year and the date depending on where I roll my mouse over to.

               

              Is it possible to get the entire dateString to display in this case when one mouseOvers?

               

              Thanks in advance.

               

              Alice

              • 4. Re: Is it Possible to Use MouseOver in DateChooser?
                agorman_co Level 1

                It's been a while since you posted this, I'm not sure if you ever figured this out. I am trying to do the

                same thing, but haven't figured it out yet. did you figure it out?

                 

                Andy