| <?xml version="1.0" encoding="utf-8"?> |
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| --> |
| <comps:IntegrationTemplate xmlns:fx="http://ns.adobe.com/mxml/2009" |
| xmlns:s="library://ns.adobe.com/flex/spark" |
| xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:comps="comps.*" width="400" height="300" |
| initialize="onInit()"> |
| <fx:Script> |
| <![CDATA[ |
| import mx.events.EffectEvent; |
| import mx.events.FlexEvent; |
| |
| public var timer:Timer; |
| |
| protected function onInit():void |
| { |
| this.valueFunction = getX; |
| this.toValue = 250; |
| this.timer = new Timer(800); |
| } |
| |
| protected function getX() : Number { |
| return target.x; |
| } |
| |
| public function performTest() : void { |
| timer.addEventListener(TimerEvent.TIMER,reverse); |
| timer.start(); |
| currentState = "One"; |
| } |
| |
| private function reverse(...event:Array) : void { |
| timer.stop(); |
| this.fromValue = getX(); |
| this.enableCheck(); |
| this.ignoreNext = true; |
| this.strict = false; |
| currentState = "Three"; |
| } |
| ]]> |
| </fx:Script> |
| <comps:transitions> |
| <s:Transition id="oneTwo" fromState="One" toState="Two" autoReverse="true"> |
| <s:Move target="{target}" duration="1000" |
| effectStart="effectStart(event)" |
| effectEnd="effectEnd(event)" |
| effectUpdate="effectUpdate(event)" |
| effectStop="effectStop(event)" |
| effectRepeat="effectRepeat(event)" |
| /> |
| </s:Transition> |
| <s:Transition id="twoThree" fromState="Two" toState="Three" autoReverse="true"> |
| <s:Move target="{target}" duration="1000" |
| effectStart="effectStart(event)" |
| effectEnd="effectEnd(event)" |
| effectUpdate="effectUpdate(event)" |
| effectStop="effectStop(event)" |
| effectRepeat="effectRepeat(event)" |
| /> |
| </s:Transition> |
| <s:Transition id="oneThree" fromState="One" toState="Three" autoReverse="true"> |
| <s:Move target="{target}" duration="1000" |
| effectStart="effectStart(event)" |
| effectEnd="effectEnd(event)" |
| effectUpdate="effectUpdate(event)" |
| effectStop="effectStop(event)" |
| effectRepeat="effectRepeat(event)" |
| /> |
| </s:Transition> |
| </comps:transitions> |
| <comps:states> |
| <s:State name="One"/> |
| <s:State name="Two"/> |
| <s:State name="Three"/> |
| <s:State name="Four"/> |
| </comps:states> |
| <s:Rect id="target" width="50" height="50" |
| y.One="50" x.One="50" |
| y.Two="50" x.Two="150" |
| y.Three="50" x.Three="250"> |
| <s:fill> |
| <s:SolidColor color="#00FF00"/> |
| </s:fill> |
| </s:Rect> |
| </comps:IntegrationTemplate> |