1 Reply Latest reply on Jun 9, 2009 4:08 PM by onditz

    Button moves when effect applies

    onditz

      Hello,

       

      I'm having a little problem with the effects on my buttons. They move by themselves

       

      I'll copy my effect code, because this is my first Flex project and maybe I'm doing something wrong:

      <mx:Sequence id="buttonAnimation1">
                <mx:Parallel duration="350" >
                     <mx:Zoom  zoomHeightFrom="1" zoomWidthFrom="1" zoomHeightTo="1.5" zoomWidthTo="1.5"/>
                     <mx:Fade  alphaFrom="1" alphaTo="0"/>
                </mx:Parallel>
                <mx:Parallel duration="100">
                     <mx:Zoom zoomHeightFrom="3" zoomWidthFrom="3" zoomHeightTo="1.5" zoomWidthTo="1.5"/>
                     <mx:Fade alphaFrom="0.4" alphaTo="0"/> 
                </mx:Parallel>
                <mx:Parallel  duration="200">
                     <mx:Zoom  zoomHeightFrom="1.5" zoomWidthFrom="1.5" zoomHeightTo="1" zoomWidthTo="1"/>
                     <mx:Fade  alphaFrom="0" alphaTo="1"/>
                </mx:Parallel>
           </mx:Sequence>
      

      Does anyone know how to fix this?

       

      Thank you.

        • 1. Re: Button moves when effect applies
          onditz Level 1

          Hello!

           

          I changed the code and now I'm executing the effect when you click on the button. It works OK. It makes the zoom and the fade but the button doesn't move from it's place.

           

          Something like this:

           

          <effects:effect id="effect" target="{waterButton}"/>
          <mx:Button  id="waterButton" y="51" width="37" height="37" upSkin="@Embed('../pictures/water.gif')" click="effect.play()" x="810"/
          

           

          The problem comes again when I want to execute another function at the same time. If i do:

          click="effect.play();showGraph()"

          or

          click="effect.play()" buttonDown="showGraph()"

           

          where "showGraph" only makes visible or invisible a panel that contains a graph.

           

          public function showGraph():void{
               if(graphPanel.visible==true){
                    graphPanel.visible=false;
               }else{
                    graphPanel.visible=true;
               }
          }
          

           

          The code makes the graph panel visible, executes the effect and when this finishes the button jumps to the right and down. I don't know why and how to solve this.

           

          Please help me, I'm lost.