2 Replies Latest reply on Dec 19, 2007 12:25 PM by sulletf

    mouse events chain

    sulletf
      Hi,

      is it normal that ( mouseMove + mouseOver) but also mouseOut be triggered when I move from outside overto a button (for instance) ??

      i was sure than mouseOut would be triggered only when the mouse "goes out" off the control area ! Am I so wrong ?

      This is an example :

      <?xml version="1.0"?>

      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">
      <mx:Script>
      <![CDATA[
      import mx.controls.*;

      private function mouseover(event:Event):void {
      Alert.show('mouseover - target=' + event.target.name + ' - currentarget=' + event.currentTarget.name);
      }
      private function mouseout(event:Event):void {
      Alert.show('mouseout - target=' + event.target.name + ' - currentarget=' + event.currentTarget.name);
      }
      private function mousemove(event:Event):void {
      Alert.show('mousemove - target=' + event.target.name + ' - currentarget=' + event.currentTarget.name);
      }

      ]]>
      </mx:Script>

      <mx:Button width="100" height="100" mouseOver="mouseover(event)" mouseOut="mouseout(event)" mouseMove="mousemove(event)"/>

      </mx:Application>
        • 1. Re: mouse events chain
          m_hartnett Level 3
          I believe your alert windows are causing the confusion.
          This code writes to a text area and does not force the loss of focus to the button causing it to mouseOut of the button.

          You can see that the textArea statements are
          mouseOver
          mouseOut

          Uncomment the mousemove and it will produce a lot of output.

          <?xml version="1.0"?>

          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">
          <mx:Script>
          <![CDATA[
          import mx.controls.*;

          private function mouseover(event:Event):void {
          textA.text = textA.text + "mouseOver\n"
          }
          private function mouseout(event:Event):void {
          textA.text = textA.text + "mouseOut\n"
          }
          private function mousemove(event:Event):void {
          //textA.text = textA.text + "mouseMove\n"
          }

          ]]>
          </mx:Script>

          <mx:Button width="100" height="100" mouseOver="mouseover(event)" mouseOut="mouseout(event)" mouseMove="mousemove(event)"/>
          <mx:TextArea id="textA" width="354" height="110"/>

          </mx:Application>
          • 2. Re: mouse events chain
            sulletf Level 1
            you are just right.

            Thanks for this : doubt started in me ;)