Jan
15
2011
AnimateFilter, in other words, is a kind of animation by dynamically changing properties of the filters; these filters include DropShadowFilter, GlowFilter, BlurFilter and ShaderFilter. In Flex, we can easily add filters for components. That's to say, we can easily add filter animations for components.
In the following example, when roll the mouse over the button, there will be a cool glow around the button. roll mouse out the button, the glow will disappear.
At first we create a new GradientGlowFilter object and a round button, the gradient glow effect is static, we can use this object to define filters property and easily debug. However, to achieve animation glow, we need define an AnimateFilter object. For the AnimateFilter object, the most important is to set its targets and filters. Filter animation, the key is to set the target animation object and filters, here are the Button btn and the GradientGlowFilter glow. AnimateFilter class is extended from Animate class, so we need to set motionPath property. Here we define a SimpleMotionPath object with the property property set to strength, the valueFrom property set to 0 and the valueTo set property set to 5. That is to say, we just change the light intensity of the filter. Finally, we set the mouse events to control the playback if the filter animation.
Viewthe demo, Download the source code.
原文:http://www.riafan.com/article/flex/glow-button-with-animatefilter.html