manel
manel

Reputation: 9

Flex: How to create a color Glow filter with duration

I need to highlight a button's border, so I have created a glow filter like this:

<s:GlowFilter id="GlowFilter1"
  color="0xD9D919"
   blurX="30" blurY="40"
  alpha="1"
 />

The problem is that I don't know to remove the effect. The effect remains in the opction as it was highlighted. Thus, I'd like to set a duration, or something that removes the effect I create.

Thanks.

Upvotes: 0

Views: 2103

Answers (3)

J_A_X
J_A_X

Reputation: 12847

I can't say I'm a fan for Flex's filters/animations. They seems overly cluttered to me. I personally use TweenMax because it's fast and easy to use. In this case, if you wanted to create a glow filter, you'd do this:

import com.greensock.*; 
import com.greensock.easing.*;
import com.greensock.plugins.*;

// First you need to 'activate' the plugin.  Only need to do this once on app startup.
TweenPlugin.activate([GlowFilterPlugin]);

// Fade in glow
TweenMax.to(yourComponent, 1, {glowFilter:{color:0x91e600, alpha:1, blurX:30, blurY:30}});

// Fade out glow
TweenMax.to(yourComponent, 1, {glowFilter:{alpha:0, remove:true}});

Easy huh? :)

Upvotes: 1

Florian F
Florian F

Reputation: 8875

IF you use Flex 3, use the AnimateProperty class.

There is an example in the doc

Upvotes: 1

Igor Milla
Igor Milla

Reputation: 2786

According to adobe live docs.

Removing filters from a display object

Removing all filters from a display object is as simple as assigning a null value to the filters property:

myDisplayObject.filters = null;

So if you want, you can set filter to the null after some time using Timer, or put this in the event (e.g. MouseOut)

Upvotes: 2

Related Questions