开发者

Flex Glow effect customization

开发者 https://www.devze.com 2022-12-11 00:47 出处:网络
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 accompl

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:

<开发者_StackOverflow中文版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>


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消