1 Reply Latest reply on Sep 14, 2010 11:08 PM by ShardulSingh

    Mouse over effect for Button

    Flex Rock Level 1

      Hi,

          I have a button inside a vbox. I need to give mouse over effect to that button. Please give me the code.

       

      Regards,

      Jayagopal.

        • 1. Re: Mouse over effect for Button
          ShardulSingh Level 3

          Pls let me know if you have any issue with solution below:-

           

           

           

          <?xml version="1.0"?>


          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
          <mx:Script>
              <![CDATA[
                  import mx.effects.effectClasses.ResizeInstance;
                     
                  private var resizeInstance:ResizeInstance;
                 
                  public function mouseHandler(event:MouseEvent):void
                  {
                          if (resizeInstance)
                          {
                              resizeInstance.reverse();
                          }
                          else
                          {
                              resizeEffect.play([event.currentTarget],event.type==MouseEvent.MOUSE_OUT);
                          }
                  }
          ]]>
          </mx:Script>

           

          <mx:Resize id="resizeEffect" heightFrom="22" heightTo="50" 
              effectStart="resizeInstance = ResizeInstance(event.effectInstance);"
              effectEnd="resizeInstance=null"/>
          <mx:VBox width="500" height="500" horizontalAlign="center" verticalAlign="middle">
              <mx:Button label="Sample Button" buttonMode="true"
              useHandCursor="true" mouseOver="mouseHandler(event)" mouseOut="mouseHandler(event)" />   
          </mx:VBox>

           

          </mx:Application>

           

           

           

           

           

          with Reagrds,

           

          Shardul Singh Bartwal