0 Replies Latest reply on Feb 28, 2010 9:51 PM by mchanggg

    Problem with Mx:Move

    mchanggg

      Hi,
      I have a mouseover hover button with the following code.

       

      The problem is, it starts out at a lower position (I'm guessing -5) then what it ends up being after both mouseOver and mouseOut is triggered.

      I can't seem to figure it out because startY seems to have changed in between onCreationComplete and mouseOutHandler.


      Any idea?

       

      Thanks,

      Mike

       

       

      <?xml version="1.0" encoding="utf-8"?>

       

      <mx:LinkButton

       

       

      xmlns:mx="http://www.adobe.com/2006/mxml"

      mouseOver = "{mouseOverHandler(event);}"

      mouseOut = "{mouseOutHandler(event);}"

      creationComplete="{creationComplete();}"

      >

       

       

      <mx:Script>

      <![CDATA[

       

       

       

      private var startY : int;

       

      private function mouseOutHandler(event : MouseEvent) : void {

      hoverSequence.stop();

       

      this.y = startY;

      }

       

      private function mouseOverHandler(event : MouseEvent) : void {

       

      this.y = startY;

      hover();

      }

       

      private function hover():void {

      hoverSequence.play();

      }

       

      private function creationComplete() : void {

       

      startY =

      this.y;

       

      this.y = startY;

      }

      ]]>

       

      </mx:Script>

       

       

       

       

       

      <mx:Sequence id="hoverSequence" repeatCount="0" repeatDelay="0">

       

       

      <mx:Move target="{this}" yBy="-5" duration="200"/>

       

       

      <mx:Move target="{this}" yBy="5" duration="200"/>

       

       

      </mx:Sequence>

       

      </mx:LinkButton>