<?xml version="1.0" encoding="utf-8"?>
<!---
Filter Sample (AnimateFilter)
-->
<s:Application
xmlns:fx = "http://ns.adobe.com/mxml/2009"
xmlns:s = "library://ns.adobe.com/flex/spark"
xmlns:mx = "library://ns.adobe.com/flex/halo"
minWidth = "1024"
minHeight = "768"
viewSourceURL = "srcview/index.html"
>
<fx:Style>
@namespace mx "library://ns.adobe.com/flex/halo";
@namespace s "library://ns.adobe.com/flex/spark";
s|Button {
font-size : 40;
}
</fx:Style>
<fx:Script>
<![CDATA[
import spark.filters.BevelFilter;
import spark.filters.BlurFilter;
import spark.effects.AnimateFilter;
import spark.effects.animation.RepeatBehavior;
import spark.effects.SimpleMotionPath;
import spark.effects.WipeDirection;
protected var animateFilter :AnimateFilter;
protected var blurFilter :BlurFilter;
protected var bevelFilter :BevelFilter;
protected var smpX :SimpleMotionPath;
protected var smpY :SimpleMotionPath;
/** @inheritDoc */
protected override function createChildren() : void {
super.createChildren();
blurFilter = new BlurFilter();
animateFilter = new AnimateFilter(button, blurFilter);
smpX = new SimpleMotionPath("blurX", 0, 20);
smpY = new SimpleMotionPath("blurY", 0, 20);
animateFilter.motionPaths = [smpX, smpY];
}
/** @private */
protected function doBlurSample():void {
animateFilter.repeatCount = 0;
animateFilter.repeatBehavior = RepeatBehavior.REVERSE;
animateFilter.play();
}
/** @private */
private function stopAnimation():void {
animateFilter.stop();
}
]]>
</fx:Script>
<s:layout>
<s:VerticalLayout horizontalAlign="center" />
</s:layout>
<mx:Spacer height="10" />
<s:Button
id = "button"
width = "400"
height = "100"
label = "doBlurSample()"
click = "doBlurSample()"
/>
<s:Button
width = "400"
height = "100"
label = "stopAnimation()"
click = "stopAnimation()"
/>
</s:Application>