<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" xmlns:utils="utils.*"
viewSourceURL="srcview/index.html"
width="300" height="200">
<fx:Script>
<![CDATA[
import utils.AnimationEvent;
private function updateHandler(event:AnimationEvent):void
{
button.x = event.animation.currentValue["x"];
button.y = event.animation.currentValue["y"];
}
]]>
</fx:Script>
<fx:Declarations>
<utils:AnimationTargetDispatcher id="animTarget"
update="updateHandler(event)"/>
<s:Animation id="anim" duration="500"
repeatBehavior="reverse" repeatCount="0"
animationTarget="{animTarget}">
<s:SimpleMotionPath property="x" valueFrom="0"
valueTo="{width - button.width}"/>
<s:SimpleMotionPath property="y" valueFrom="0"
valueTo="{height - button.height}"/>
</s:Animation>
</fx:Declarations>
<s:Button id="button" label="Move Me" click="anim.play()"/>
</s:Application>