Simple Effects in Flex

I would like to show hidden text in a Flex application and fade it out in a couple of seconds ...

I looked at the Delay and Pause effects in Flex, but have not yet seen an example of how to make this realistically light effect ...

anyone now how to do this or have a good resource?

Thank.

+3
source share
1 answer

If I understand you correctly, do you want the text to automatically disappear a few seconds after it is displayed?

I would probably do something like this: (I have not tested the code, so there are typos.)

<mx:Script>
    import flash.utils.*;

    var fadeTimer:Timer = new Timer(2000); // 2 seconds
    fadeTimer.addEventListener("timer", fadeTimerTickHandler);

    // Call this to show the hidden text.
    function showTheText():void{
        theTextField.visible = true;
        fadeTimer.start();
        }

    // This gets called every time the timer "ticks" (2 seconds)
    function fadeTimerTickHandler(eventArgs:TimerEvent){
       fadeTimer.stop();
       fadeTimer.reset();
       theTextField.visible = false;
       }
</mx:Script>

<mx:Fade id="hideEffectFade" alphaFrom="1.0" alphaTo="0.0" duration="900"/>

<mx:Text id="theTextField" text="The Text" hideEffect="{hideEffectFade}"/>

In addition, you must be sure to paste your fonts, or the effect will not work on your text. See the Simeon post for more information.

+2
source

Source: https://habr.com/ru/post/1696657/


All Articles