tags:

views:

571

answers:

1

Hi, all.

I use Flex's Glow effects in my custom VBox-based component for highlighting it on roll over. It looks great. But I would like it to have rectangular shape with gradient to alpha 0. How can I accomplish that? Should I add some properties to Glow effect or mix it somehow with other effects or use another effect?

Code is below:

<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" rollOverEffect="{select}" rollOutEffect="{deselect}">
    <!-- Some stuff skipped -->
    <mx:Glow id="select" duration="500">
        <mx:color>#9BC227</mx:color>
        <mx:blurXFrom>100</mx:blurXFrom>       
        <mx:blurXTo>100</mx:blurXTo>
        <mx:blurYFrom>100</mx:blurYFrom>
        <mx:blurYTo>100</mx:blurYTo>
        <mx:alphaFrom>0</mx:alphaFrom>
        <mx:alphaTo>1</mx:alphaTo>
    </mx:Glow>
    <mx:Glow id="deselect" duration="1000">
        <mx:color>#9BC227</mx:color>
        <mx:blurXFrom>100</mx:blurXFrom>       
        <mx:blurXTo>0</mx:blurXTo>
        <mx:blurYFrom>100</mx:blurYFrom>
        <mx:blurYTo>0</mx:blurYTo>
        <mx:alphaFrom>1</mx:alphaFrom>
        <mx:alphaTo>0</mx:alphaTo>
     </mx:Glow>

+1  A: 

I don't think there is an mx.effects class that wraps it up with a tween, but there is a GradientGlowFilter class in flash.filters. All Glow does is return a GlowInstance, which when played applies a series of Glow filters using a tween. The code is very simple, and you could modify it to use a different filter pretty easily.

Ryan Lynch