First you need to create effect objects. In the sample below you can find 2 fade effects and 2 move effects.

 

There 2 approaches that I use:

 

  1. If you want an effect on a UI element that triggers the effect itself, such as the text input controls in the sample below, and if you are using an effect event, such as “focusInEffect” (they typically have “effect” as a postfix in their name), it’s enough to give the name of the effect object.
  2. Or, if you want to trigger an effect by other events, such as “change”, “click”, or if you want to trigger the effect from a different place altogether (see the swap button in the example), then you need to “play()” the effects “manually”. The effect objects need to know which targets (UI elements) they play on, and you can either provide this as value for the target properties, the targets array property, or in the play function call as targets array in the argument. In the button example I use the first option.  

 

HTH

 

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

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

      

       <mx:Fade  alphaFrom="0.2" alphaTo="1" id="myFadeIn" duration="500"/>

       <mx:Fade  alphaFrom="1" alphaTo="0.2" id="myFadeOut" duration="500"/>

      

       <mx:TextInput x="27" y="27" text=""  alpha="0.2" focusInEffect="myFadeIn" focusOutEffect="myFadeOut" id="myText" />

       <mx:TextInput x="27" y="54" text=""  alpha="0.2" focusInEffect="myFadeIn" focusOutEffect="myFadeOut" id="myText2" />

      

       <!-- non-effect event triggered effects -->

 

       <mx:Script>

              <![CDATA[

                     public function handleSwap() : void

                     {

                           if (myText.y > 27)

                           {

                                  MoveUp.target = myText;

                                  MoveDown.target = myText2;

                           }

                           else

                           {

                                  MoveUp.target = myText2;

                                  MoveDown.target = myText;

                           }

                           MoveUp.play();

                           MoveDown.play();

                     }

              ]]>

       </mx:Script>

       <mx:Move id="MoveUp"  yFrom="54" yTo="27" duration="500"/>

       <mx:Move id="MoveDown"  yFrom="27" yTo="54" duration="500"/>

      

       <mx:Button label="Swap Text Fields" click="handleSwap()"/>

 

</mx:Application>

 

 


From: [email protected] [mailto:[email protected]] On Behalf Of Pascal Schrafl
Sent: Sunday, November 05, 2006 1:42 PM
To: [email protected]
Subject: [flexcoders] Fade Text in and out, when text variable is changed

 

Hi all,

I have some text, that gets retrieved from some variables (those
variables get retrieved from an xml-file). I would like to fade in the
text, when the variable changes and fade it out, when the old text is
replaced by the new one (i.e. again the variable changes). I tried
showEffect="Fade" hideEffect="Fade" but it didn't work. Can anyone point
me in the right direction?

Thanks a lot for your answers and best regards,

Pascal

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to