You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2012/08/07 19:13:35 UTC
svn commit: r1370370 [31/43] - in /incubator/flex/trunk/mustella/tests/mx:
./ binding/ binding/utils/ binding/utils/BindingUtils/
binding/utils/BindingUtils/SWFs/ binding/utils/BindingUtils/SWFs/assets/
binding/utils/BindingUtils/method/ binding/utils/...
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/Rotate3DFadeComponents.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/Rotate3DFadeComponents.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/Rotate3DFadeComponents.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/Rotate3DFadeComponents.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,58 @@
+<?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.
+
+-->
+<s:Group 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:d="assets.*" width="400" height="300"
+ currentState="State1">
+ <s:states>
+ <s:State name="State1"/>
+ <s:State name="State2"/>
+ <s:State name="State3"/>
+ </s:states>
+ <s:layout>
+ <s:VerticalLayout />
+ </s:layout>
+
+ <s:Panel width="500" height="600">
+ <s:ComboBox id="combo1" x="211" y="215" rotationX.State1="45" rotationX.State2="90"
+ rotationX.State3="270" rotationY.State1="45" rotationY.State2="90"
+ rotationY.State3="270" rotationZ.State1="45" rotationZ.State2="90"
+ rotationZ.State3="270" alpha.State1="0.5" alpha.State2="1" alpha.State3="0">
+ <s:dataProvider>
+ <s:ArrayList>
+ <fx:String>ProductD</fx:String>
+ <fx:String>ProductF</fx:String>
+ <fx:String>ProductL</fx:String>
+ <fx:String>ProductP</fx:String>
+ </s:ArrayList>
+ </s:dataProvider>
+ </s:ComboBox>
+ </s:Panel>
+
+ <s:transitions>
+ <s:Transition id="mainTransition" fromState="*" toState="*">
+ <s:Sequence startDelay="50">
+ <s:Rotate3D duration="600" target="{combo1}"/>
+ <s:Fade duration="600" target="{combo1}"/>
+ </s:Sequence>
+ </s:Transition>
+ </s:transitions>
+</s:Group>
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/Rotate3DFadeTemplate.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/Rotate3DFadeTemplate.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/Rotate3DFadeTemplate.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/Rotate3DFadeTemplate.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,92 @@
+<?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.
+
+-->
+<c:TransitionTemplate 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:c="comps.*"
+ width="500" height="300" initialize="onInit()">
+ <fx:Script>
+ <![CDATA[
+ import mx.events.FlexEvent;
+
+ protected function onInit():void
+ {
+ this.valueFunction = getNumber;
+ this.initTrans = initMove;
+ this.returnTrans = returnMove;
+ }
+
+ protected function getNumber() : Number {
+ return (target.alpha*180) + target.rotationY
+ }
+
+ ]]>
+ </fx:Script>
+
+ <fx:Declarations>
+ <s:Transition id="initMove" fromState="One" toState="Two" autoReverse="true">
+ <s:Sequence>
+ <s:children>
+ <s:Rotate3D target="{target}" duration="500"
+ effectStart="effectStart(event)"
+ effectEnd="effectEnd(event)"
+ effectUpdate="effectUpdate(event)"
+ effectStop="effectStop(event)"
+ effectRepeat="effectRepeat(event)"
+ />
+ <s:Fade target="{target}" duration="500"
+ effectStart="effectStart(event)"
+ effectEnd="effectEnd(event)"
+ effectUpdate="effectUpdate(event)"
+ effectStop="effectStop(event)"
+ effectRepeat="effectRepeat(event)"
+ />
+ </s:children>
+ </s:Sequence>
+ </s:Transition>
+ <s:Transition id="returnMove" fromState="Two" toState="One" autoReverse="true">
+ <s:Sequence>
+ <s:Rotate3D target="{target}" duration="1000"
+ effectStart="effectStart(event)"
+ effectEnd="effectEnd(event)"
+ effectUpdate="effectUpdate(event)"
+ effectStop="effectStop(event)"
+ effectRepeat="effectRepeat(event)"
+ />
+ <s:Fade target="{target}" duration="1000"
+ effectStart="effectStart(event)"
+ effectEnd="effectEnd(event)"
+ effectUpdate="effectUpdate(event)"
+ effectStop="effectStop(event)"
+ effectRepeat="effectRepeat(event)"
+ />
+ </s:Sequence>
+ </s:Transition>
+ </fx:Declarations>
+ <c:states>
+ <s:State name="One"/>
+ <s:State name="Two"/>
+ </c:states>
+ <s:Rect id="target" y="50" x="50" width="50" height="50" depth="50" rotationY.One="0" rotationY.Two="180" alpha.One="0.1" alpha.Two="1">
+ <s:fill>
+ <s:SolidColor color="#0000FF"/>
+ </s:fill>
+ </s:Rect>
+</c:TransitionTemplate>
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/Rotate3DTemplate.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/Rotate3DTemplate.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/Rotate3DTemplate.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/Rotate3DTemplate.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,72 @@
+<?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.
+
+-->
+<c:TransitionTemplate 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:c="comps.*"
+ width="500" height="300" initialize="onInit()">
+ <fx:Script>
+ <![CDATA[
+ import mx.events.FlexEvent;
+
+ protected function onInit():void
+ {
+ this.valueFunction = getRot;
+ this.initTrans = initMove;
+ this.returnTrans = returnMove;
+ }
+
+ protected function getRot() : Number {
+ return target.rotationY;
+ }
+
+ ]]>
+ </fx:Script>
+
+ <fx:Declarations>
+ <s:Transition id="initMove" fromState="One" toState="Two" autoReverse="true">
+ <s:Rotate3D target="{target}" duration="1000"
+ effectStart="effectStart(event)"
+ effectEnd="effectEnd(event)"
+ effectUpdate="effectUpdate(event)"
+ effectStop="effectStop(event)"
+ effectRepeat="effectRepeat(event)"
+ />
+ </s:Transition>
+ <s:Transition id="returnMove" fromState="Two" toState="One" autoReverse="true">
+ <s:Rotate3D target="{target}" duration="2000"
+ effectStart="effectStart(event)"
+ effectEnd="effectEnd(event)"
+ effectUpdate="effectUpdate(event)"
+ effectStop="effectStop(event)"
+ effectRepeat="effectRepeat(event)"
+ />
+ </s:Transition>
+ </fx:Declarations>
+ <c:states>
+ <s:State name="One"/>
+ <s:State name="Two"/>
+ </c:states>
+ <s:Rect id="target" y="50" x="50" rotationY.One="0" rotationY.Two="180" width="50" height="50" >
+ <s:fill>
+ <s:SolidColor color="#009900"/>
+ </s:fill>
+ </s:Rect>
+</c:TransitionTemplate>
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/RotateComponents.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/RotateComponents.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/RotateComponents.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/RotateComponents.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,49 @@
+<?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.
+
+-->
+<s:Group 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:d="assets.*" width="400" height="300"
+ currentState="State1">
+ <s:states>
+ <s:State name="State1"/>
+ <s:State name="State2"/>
+ <s:State name="State3"/>
+ </s:states>
+ <s:layout>
+ <s:VerticalLayout />
+ </s:layout>
+
+ <s:Panel width="500" height="600">
+ <s:Button id="button1" label="Spark Button" x="211" y="215" rotation.State1="45" rotation.State2="90"
+ rotation.State3="180"/>
+ <d:twist_path id="fxgType" x="360" y="105" rotation.State1="180" rotation.State2="75"
+ rotation.State3="0" width="200" height="75"/>
+ </s:Panel>
+
+ <s:transitions>
+ <s:Transition id="mainTransition" fromState="*" toState="*" >
+ <s:Parallel startDelay="50">
+ <s:Rotate duration="1500" target="{button1}"/>
+ <s:Rotate duration="2500" target="{fxgType}"/>
+ </s:Parallel>
+ </s:Transition>
+ </s:transitions>
+</s:Group>
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/RotateScaleComponents.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/RotateScaleComponents.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/RotateScaleComponents.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/RotateScaleComponents.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,56 @@
+<?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.
+
+-->
+<s:Group 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:d="assets.*" width="400" height="300"
+ currentState="State1">
+ <s:states>
+ <s:State name="State1"/>
+ <s:State name="State2"/>
+ <s:State name="State3"/>
+ </s:states>
+ <s:layout>
+ <s:VerticalLayout />
+ </s:layout>
+
+ <s:Panel width="500" height="600">
+ <s:List id="list1" x="211" y="215" rotation.State1="45" rotation.State2="90"
+ rotation.State3="180" scaleX.State1="1" scaleY.State1="1" scaleX.State2="2" scaleY.State2="2"
+ scaleX.State3="0.5" scaleY.State3="0.5">
+ <s:dataProvider>
+ <s:ArrayList>
+ <fx:String>Frosty</fx:String>
+ <fx:String>Rudolph</fx:String>
+ <fx:String>Santa</fx:String>
+ </s:ArrayList>
+ </s:dataProvider>
+ </s:List>
+ </s:Panel>
+
+ <s:transitions>
+ <s:Transition id="mainTransition" fromState="*" toState="*" >
+ <s:Parallel startDelay="50">
+ <s:Rotate duration="500" target="{list1}"/>
+ <s:Scale duration="500" target="{list1}"/>
+ </s:Parallel>
+ </s:Transition>
+ </s:transitions>
+</s:Group>
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/RotateTemplate.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/RotateTemplate.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/RotateTemplate.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/RotateTemplate.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,72 @@
+<?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.
+
+-->
+<c:TransitionTemplate 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:c="comps.*"
+ width="500" height="300" initialize="onInit()">
+ <fx:Script>
+ <![CDATA[
+ import mx.events.FlexEvent;
+
+ protected function onInit():void
+ {
+ this.valueFunction = getRot;
+ this.initTrans = initMove;
+ this.returnTrans = returnMove;
+ }
+
+ protected function getRot() : Number {
+ return target.rotation;
+ }
+
+ ]]>
+ </fx:Script>
+
+ <fx:Declarations>
+ <s:Transition id="initMove" fromState="One" toState="Two" autoReverse="true">
+ <s:Rotate target="{target}" duration="1000"
+ effectStart="effectStart(event)"
+ effectEnd="effectEnd(event)"
+ effectUpdate="effectUpdate(event)"
+ effectStop="effectStop(event)"
+ effectRepeat="effectRepeat(event)"
+ />
+ </s:Transition>
+ <s:Transition id="returnMove" fromState="Two" toState="One" autoReverse="true">
+ <s:Rotate target="{target}" duration="2000"
+ effectStart="effectStart(event)"
+ effectEnd="effectEnd(event)"
+ effectUpdate="effectUpdate(event)"
+ effectStop="effectStop(event)"
+ effectRepeat="effectRepeat(event)"
+ />
+ </s:Transition>
+ </fx:Declarations>
+ <c:states>
+ <s:State name="One"/>
+ <s:State name="Two"/>
+ </c:states>
+ <s:Rect id="target" y="50" x="50" rotation.One="0" rotation.Two="180" width="50" height="50" >
+ <s:fill>
+ <s:SolidColor color="#00FF00"/>
+ </s:fill>
+ </s:Rect>
+</c:TransitionTemplate>
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/Scale3DComponents.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/Scale3DComponents.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/Scale3DComponents.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/Scale3DComponents.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,50 @@
+<?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.
+
+-->
+<s:Group 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:d="assets.*" width="400" height="300"
+ currentState="State1">
+ <s:states>
+ <s:State name="State1"/>
+ <s:State name="State2"/>
+ <s:State name="State3"/>
+ </s:states>
+ <s:layout>
+ <s:VerticalLayout />
+ </s:layout>
+
+ <s:Panel width="500" height="600">
+ <s:Button id="button1" label="Spark Button" x="11" y="15"
+ scaleX.State1="1" scaleY.State1="1" scaleX.State2=".5" scaleY.State2=".5"
+ scaleX.State3="2" scaleY.State3="2" scaleZ.State1="1" scaleZ.State2=".5" scaleZ.State3="2"/>
+ <d:twist_path id="fxgType" x="60" y="105" scaleX.State1="1" scaleY.State1="1" scaleX.State2=".5" scaleY.State2=".5"
+ scaleX.State3="2" scaleY.State3="2" scaleZ.State1="1" scaleZ.State2=".5" scaleZ.State3="2" width="200" height="75"/>
+ </s:Panel>
+
+ <s:transitions>
+ <s:Transition id="mainTransition" fromState="*" toState="*" >
+ <s:Parallel startDelay="160">
+ <s:Scale3D duration="1500" target="{button1}"/>
+ <s:Scale3D duration="2500" target="{fxgType}"/>
+ </s:Parallel>
+ </s:Transition>
+ </s:transitions>
+</s:Group>
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/Scale3DTemplate.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/Scale3DTemplate.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/Scale3DTemplate.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/Scale3DTemplate.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,72 @@
+<?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.
+
+-->
+<c:TransitionTemplate 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:c="comps.*"
+ width="500" height="300" initialize="onInit()">
+ <fx:Script>
+ <![CDATA[
+ import mx.events.FlexEvent;
+
+ protected function onInit():void
+ {
+ this.valueFunction = getScale;
+ this.initTrans = initMove;
+ this.returnTrans = returnMove;
+ }
+
+ protected function getScale() : Number {
+ return target.scaleZ;
+ }
+
+ ]]>
+ </fx:Script>
+
+ <fx:Declarations>
+ <s:Transition id="initMove" fromState="One" toState="Two" autoReverse="true">
+ <s:Scale3D target="{target}" duration="1000"
+ effectStart="effectStart(event)"
+ effectEnd="effectEnd(event)"
+ effectUpdate="effectUpdate(event)"
+ effectStop="effectStop(event)"
+ effectRepeat="effectRepeat(event)"
+ />
+ </s:Transition>
+ <s:Transition id="returnMove" fromState="Two" toState="One" autoReverse="true">
+ <s:Scale3D target="{target}" duration="2000"
+ effectStart="effectStart(event)"
+ effectEnd="effectEnd(event)"
+ effectUpdate="effectUpdate(event)"
+ effectStop="effectStop(event)"
+ effectRepeat="effectRepeat(event)"
+ />
+ </s:Transition>
+ </fx:Declarations>
+ <c:states>
+ <s:State name="One"/>
+ <s:State name="Two"/>
+ </c:states>
+ <s:Rect id="target" y="50" x="50" width="50" depth="50" scaleZ.One="1" scaleZ.Two="8" height="50">
+ <s:fill>
+ <s:SolidColor color="#000099"/>
+ </s:fill>
+ </s:Rect>
+</c:TransitionTemplate>
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/ScaleComponents.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/ScaleComponents.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/ScaleComponents.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/ScaleComponents.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,50 @@
+<?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.
+
+-->
+<s:Group 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:d="assets.*" width="400" height="300"
+ currentState="State1">
+ <s:states>
+ <s:State name="State1"/>
+ <s:State name="State2"/>
+ <s:State name="State3"/>
+ </s:states>
+ <s:layout>
+ <s:VerticalLayout />
+ </s:layout>
+
+ <s:Panel width="500" height="600">
+ <s:Button id="button1" label="Spark Button" x="11" y="15"
+ scaleX.State1="1" scaleY.State1="1" scaleX.State2=".5" scaleY.State2=".5"
+ scaleX.State3="2" scaleY.State3="2"/>
+ <d:twist_path id="fxgType" x="60" y="105" scaleX.State1="1" scaleY.State1="1" scaleX.State2=".5" scaleY.State2=".5"
+ scaleX.State3="2" scaleY.State3="2" width="200" height="75"/>
+ </s:Panel>
+
+ <s:transitions>
+ <s:Transition id="mainTransition" fromState="*" toState="*" >
+ <s:Parallel startDelay="70">
+ <s:Scale duration="1500" target="{button1}"/>
+ <s:Scale duration="2500" target="{fxgType}"/>
+ </s:Parallel>
+ </s:Transition>
+ </s:transitions>
+</s:Group>
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/ScaleTemplate.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/ScaleTemplate.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/ScaleTemplate.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/ScaleTemplate.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,72 @@
+<?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.
+
+-->
+<c:TransitionTemplate 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:c="comps.*"
+ width="500" height="300" initialize="onInit()">
+ <fx:Script>
+ <![CDATA[
+ import mx.events.FlexEvent;
+
+ protected function onInit():void
+ {
+ this.valueFunction = getScale;
+ this.initTrans = initMove;
+ this.returnTrans = returnMove;
+ }
+
+ protected function getScale() : Number {
+ return target.scaleX;
+ }
+
+ ]]>
+ </fx:Script>
+
+ <fx:Declarations>
+ <s:Transition id="initMove" fromState="One" toState="Two" autoReverse="true">
+ <s:Scale target="{target}" duration="1000"
+ effectStart="effectStart(event)"
+ effectEnd="effectEnd(event)"
+ effectUpdate="effectUpdate(event)"
+ effectStop="effectStop(event)"
+ effectRepeat="effectRepeat(event)"
+ />
+ </s:Transition>
+ <s:Transition id="returnMove" fromState="Two" toState="One" autoReverse="true">
+ <s:Scale target="{target}" duration="2000"
+ effectStart="effectStart(event)"
+ effectEnd="effectEnd(event)"
+ effectUpdate="effectUpdate(event)"
+ effectStop="effectStop(event)"
+ effectRepeat="effectRepeat(event)"
+ />
+ </s:Transition>
+ </fx:Declarations>
+ <c:states>
+ <s:State name="One"/>
+ <s:State name="Two"/>
+ </c:states>
+ <s:Rect id="target" y="50" x="50" width="50" scaleX.One="1" scaleX.Two="8" height="50" >
+ <s:fill>
+ <s:SolidColor color="#0000FF"/>
+ </s:fill>
+ </s:Rect>
+</c:TransitionTemplate>
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/ScaleToEmptyComponents.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/ScaleToEmptyComponents.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/ScaleToEmptyComponents.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/ScaleToEmptyComponents.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,53 @@
+<?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.
+
+-->
+<s:Group 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:d="assets.*" width="400" height="300"
+ currentState="State1">
+ <s:states>
+ <s:State name="State1"/>
+ <s:State name="State2"/>
+ <s:State name="State3"/>
+ </s:states>
+ <s:layout>
+ <s:VerticalLayout />
+ </s:layout>
+
+ <s:Group id="group1" clipAndEnableScrolling="true" >
+ <s:Button id="button1" label="Spark Button" x="11" y="15"
+ scaleX.State1="1" scaleY.State1="1" scaleX.State2=".5" scaleY.State2=".5"
+ scaleX.State3="2" scaleY.State3="2"/>
+ <d:twist_path id="fxgType" x="60" y="105" scaleX.State1="1" scaleY.State1="1" scaleX.State2=".5" scaleY.State2=".5"
+ scaleX.State3="2" scaleY.State3="2" width="200" height="75"/>
+
+ </s:Group>
+
+
+
+ <s:transitions>
+ <s:Transition id="mainTransition" fromState="State1" toState="State2" >
+ <s:Parallel>
+ <s:Scale duration="1500" target="{button1}"/>
+ <s:Scale duration="2500" target="{fxgType}"/>
+ </s:Parallel>
+ </s:Transition>
+ </s:transitions>
+</s:Group>
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/ScaleWipeTemplate.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/ScaleWipeTemplate.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/ScaleWipeTemplate.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/ScaleWipeTemplate.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,126 @@
+<?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.
+
+-->
+<c:TransitionTemplate 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:c="comps.*"
+ width="500" height="300" initialize="onInit()">
+ <fx:Script>
+ <![CDATA[
+ import flash.display.BitmapData;
+ import flash.geom.Rectangle;
+
+ import mx.core.IUIComponent;
+ import mx.events.EffectEvent;
+ import mx.events.FlexEvent;
+
+ import spark.utils.BitmapUtil;
+
+ private var bmData:BitmapData;
+ private var bounds:Rectangle;
+
+ protected function onInit():void
+ {
+ this.valueFunction = getChange;
+ this.initTrans = initMove;
+ this.returnTrans = returnMove;
+ }
+
+ protected function getChange() : Number {
+ var point:Number = getPixel();
+ //I don't know why it thinks that the first pixel is at 0 right off the bat...
+ if(!this.monitor.isReturn && this.monitor.initialValues.length <= 3 && point == 0){
+ point = 400;
+ }else if(this.monitor.isReturn && this.monitor.returnValues.length <= 3 && point == 400){
+ point = 0;
+ }
+ return point;
+ }
+
+ private function getPixel() : Number {
+ for(var x:int = 0; x < 400; x++){
+ if(bmData.getPixel(x,25) == 0x00FFFF){
+ return x;
+ }
+ }
+ return 400;
+ }
+
+ override public function effectUpdate(event:EffectEvent):void {
+ bounds = new Rectangle();
+ bmData = BitmapUtil.getSnapshot(IUIComponent(target), bounds, true);
+ super.effectUpdate(event);
+ }
+ ]]>
+ </fx:Script>
+
+ <fx:Declarations>
+ <s:Transition id="initMove" fromState="One" toState="Two" autoReverse="true">
+ <s:Parallel>
+ <s:Scale target="{target}" duration="1000"
+ effectStart="effectStart(event)"
+ effectEnd="effectEnd(event)"
+ effectUpdate="effectUpdate(event)"
+ effectStop="effectStop(event)"
+ effectRepeat="effectRepeat(event)"
+ />
+ <s:Wipe target="{target}" duration="1000" direction="left"
+ effectStart="effectStart(event)"
+ effectEnd="effectEnd(event)"
+ effectUpdate="effectUpdate(event)"
+ effectStop="effectStop(event)"
+ effectRepeat="effectRepeat(event)"
+ />
+ </s:Parallel>
+ </s:Transition>
+ <s:Transition id="returnMove" fromState="Two" toState="One" autoReverse="true">
+ <s:Parallel>
+ <s:Scale target="{target}" duration="2000"
+ effectStart="effectStart(event)"
+ effectEnd="effectEnd(event)"
+ effectUpdate="effectUpdate(event)"
+ effectStop="effectStop(event)"
+ effectRepeat="effectRepeat(event)"
+ />
+ <s:Wipe target="{target}" duration="2000" direction="right"
+ effectStart="effectStart(event)"
+ effectEnd="effectEnd(event)"
+ effectUpdate="effectUpdate(event)"
+ effectStop="effectStop(event)"
+ effectRepeat="effectRepeat(event)"
+ />
+ </s:Parallel>
+ </s:Transition>
+ </fx:Declarations>
+ <c:states>
+ <s:State name="One"/>
+ <s:State name="Two"/>
+ </c:states>
+ <s:Group id="target" y="50" x="50" scaleY.One="2" scaleY.Two="1">
+ <s:Rect id="rect" width="400" height="50">
+ <s:fill.One>
+ <s:SolidColor color="#0000FF"/>
+ </s:fill.One>
+ <s:fill.Two>
+ <s:SolidColor color="#00FFFF"/>
+ </s:fill.Two>
+ </s:Rect>
+ </s:Group>
+</c:TransitionTemplate>
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/ShaderComponents.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/ShaderComponents.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/ShaderComponents.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/ShaderComponents.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,57 @@
+<?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.
+
+-->
+<s:Group 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:d="assets.*" width="400" height="300"
+ currentState="State1">
+ <s:states>
+ <s:State name="State1"/>
+ <s:State name="State2"/>
+ <s:State name="State3"/>
+ </s:states>
+ <s:layout>
+ <s:VerticalLayout />
+ </s:layout>
+ <s:Group>
+ <s:CheckBox id="autoReverse_check" x="5" y="5" label="autoReverse"/>
+ <s:ComboBox id="IB_check" selectedIndex="0" x="120" y="5">
+ <s:dataProvider>
+ <s:ArrayList>
+ <fx:String>stop</fx:String>
+ <fx:String>end</fx:String>
+ </s:ArrayList>
+ </s:dataProvider>
+ </s:ComboBox>
+ </s:Group>
+
+ <s:BorderContainer id="ticker" width="300" height="150" backgroundColor="0x000000">
+ <s:Label text.State1="State One" text.State2="State Two" text.State3="State Three" color="#FFFFFF"
+ textAlign="center" buttonMode="true" verticalCenter="0" fontSize="44" width="100%"/>
+ </s:BorderContainer>
+
+ <s:transitions>
+ <s:Transition interruptionBehavior="stop">
+ <s:AnimateTransitionShader target="{ticker}" duration="2100"
+ shaderByteCode="@Embed(source='HexCells.pbj', mimeType='application/octet-stream')"
+ />
+ </s:Transition>
+ </s:transitions>
+</s:Group>
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/TitleWindowComp.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/TitleWindowComp.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/TitleWindowComp.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/TitleWindowComp.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,51 @@
+<?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.
+
+-->
+<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx"
+ title="My Pop Up" >
+
+ <s:states>
+ <s:State name="State1"/>
+ <s:State name="State2"/>
+ <s:State name="State3"/>
+ </s:states>
+
+ <s:Group id="group1" clipAndEnableScrolling="true" width.State1="400" height.State1="300"
+ width.State2="100" height.State2="250" width.State3="600" height.State3="450" >
+ <s:Rect id="rect1" width="250" height="250">
+ <s:fill>
+ <s:SolidColor id="sc" color="0x00FF00"/>
+ </s:fill>
+ </s:Rect>
+ <mx:Canvas id="rect2" width="250" height="250" x="350" backgroundColor="0xFF0000" />
+
+ </s:Group>
+
+
+
+ <s:transitions>
+ <s:Transition id="mainTransition" fromState="*" toState="*" interruptionBehavior="stop">
+ <s:Sequence startDelay="50">
+ <s:Resize duration="1300" target="{group1}"/>
+ </s:Sequence>
+ </s:Transition>
+ </s:transitions>
+</s:TitleWindow>
\ No newline at end of file
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/TransitionTemplate.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/TransitionTemplate.as?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/TransitionTemplate.as (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/TransitionTemplate.as Tue Aug 7 17:13:06 2012
@@ -0,0 +1,213 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package comps
+{
+ import comps.modules.Monitor;
+
+ import flash.events.Event;
+ import flash.events.TimerEvent;
+ import flash.utils.Timer;
+
+ import mx.events.EffectEvent;
+ import mx.states.Transition;
+
+ import spark.components.Group;
+
+ public class TransitionTemplate extends Group
+ {
+ private var _monitor:Monitor;
+ private var _valueFunction:Function;
+ private var _initTransTime:Number;
+ private var _returnTransTime:Number;
+ private var _interruptTime:Number;
+ private var _initTrans:Transition;
+ private var _returnTrans:Transition;
+ private var _autoreverse:Boolean = true;
+ private var _endsPerPath:int = 1;
+ private var numEnds:int = 0;
+
+ private var interruptTimer:Timer;
+
+ public function TransitionTemplate()
+ {
+ super();
+ }
+
+ [Bindable]
+ public function get monitor():Monitor
+ {
+ return _monitor;
+ }
+
+ public function set monitor(value:Monitor):void
+ {
+ _monitor = value;
+ _monitor.valueFunction = getValue;
+ _monitor.target = this;
+ dispatchEvent(new Event("monitorRegistered"));
+ }
+
+ public function interrupt(event:TimerEvent):void{
+ currentState="One";
+ }
+
+ public function start():void {
+ if(isNaN(initTransTime)){
+ initTrans.effect.duration=1000;
+ }else{
+ initTrans.effect.duration=initTransTime;
+ }
+ initTrans.autoReverse = _autoreverse;
+
+ this.transitions.push(initTrans);
+
+ if(!isNaN(returnTransTime)){
+ returnTrans.effect.duration=returnTransTime;
+ returnTrans.autoReverse = _autoreverse;
+ this.transitions.push(returnTrans);
+ }
+ currentState="Two";
+ }
+
+ public function effectStart(event:EffectEvent):void{
+ _monitor.effectStart(event);
+ if(isNaN(_interruptTime)) _interruptTime=1100;
+ interruptTimer = new Timer(_interruptTime,1);
+ interruptTimer.addEventListener(TimerEvent.TIMER,interrupt);
+ interruptTimer.start();
+ dispatchEvent(event);
+ }
+
+ public function effectStop(event:EffectEvent):void{
+ _monitor.effectStop(event);
+ dispatchEvent(event);
+ }
+
+ public function effectUpdate(event:EffectEvent):void{
+ _monitor.effectUpdate(event);
+ dispatchEvent(event);
+ }
+
+ public function effectEnd(event:EffectEvent):void{
+ _monitor.effectEnd(event);
+ numEnds++;
+ if(numEnds == _endsPerPath) _monitor.isReturn = true;
+ dispatchEvent(event);
+ }
+
+ public function effectRepeat(event:EffectEvent):void{
+ _monitor.effectRepeat(event);
+ dispatchEvent(event);
+ }
+
+ public function check():void{_monitor.check();}
+
+ public function getValue():Number {
+ return _valueFunction.call();
+ }
+
+ protected function get valueFunction():Function
+ {
+ return _valueFunction;
+ }
+
+ protected function set valueFunction(value:Function):void
+ {
+ _valueFunction = value;
+ }
+
+ [Bindable]
+ public function get interruptTime():Number
+ {
+ return _interruptTime;
+ }
+
+ public function set interruptTime(value:Number):void
+ {
+ _interruptTime = value;
+ }
+
+ [Bindable]
+ public function get initTransTime():Number
+ {
+ return _initTransTime;
+ }
+
+ public function set initTransTime(value:Number):void
+ {
+ _initTransTime = value;
+ }
+
+ [Bindable]
+ public function get returnTransTime():Number
+ {
+ return _returnTransTime;
+ }
+
+ public function set returnTransTime(value:Number):void
+ {
+ _returnTransTime = value;
+ }
+
+ [Bindable]
+ public function get initTrans():Transition
+ {
+ return _initTrans;
+ }
+
+ public function set initTrans(value:Transition):void
+ {
+ _initTrans = value;
+ }
+
+ [Bindable]
+ public function get returnTrans():Transition
+ {
+ return _returnTrans;
+ }
+
+ public function set returnTrans(value:Transition):void
+ {
+ _returnTrans = value;
+ }
+
+ [Bindable]
+ public function get autoreverse():Boolean
+ {
+ return _autoreverse;
+ }
+
+ public function set autoreverse(value:Boolean):void
+ {
+ _autoreverse = value;
+ }
+
+ public function get endsPerPath():int
+ {
+ return _endsPerPath;
+ }
+
+ public function set endsPerPath(value:int):void
+ {
+ _endsPerPath = value;
+ }
+
+
+ }
+}
\ No newline at end of file
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/WipeComponents.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/WipeComponents.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/WipeComponents.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/WipeComponents.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,65 @@
+<?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.
+
+-->
+<s:Group 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:d="assets.*" width="400" height="300"
+ currentState="State1">
+ <s:states>
+ <s:State name="State1"/>
+ <s:State name="State2"/>
+ <s:State name="State3"/>
+ </s:states>
+ <s:layout>
+ <s:VerticalLayout />
+ </s:layout>
+ <s:Group>
+ <s:CheckBox id="autoReverse_check" x="5" y="5" label="autoReverse"/>
+ <s:ComboBox id="IB_check" selectedIndex="0" x="120" y="5">
+ <s:dataProvider>
+ <s:ArrayList>
+ <fx:String>stop</fx:String>
+ <fx:String>end</fx:String>
+ </s:ArrayList>
+ </s:dataProvider>
+ </s:ComboBox>
+ </s:Group>
+ <s:Group width="500" height="600" id="group1">
+ <s:BitmapImage
+ source="@Embed('../../../../../../Assets/Images/redrect.jpg')"
+ visible.State1="true" visible.State2="false" visible.State3="false"/>
+ <s:BitmapImage
+ source="@Embed('../../../../../../Assets/Images/greenrect.jpg')"
+ visible.State1="false" visible.State2="true" visible.State3="false"/>
+ <s:BitmapImage
+ source="@Embed('../../../../../../Assets/Images/bluerect.jpg')"
+ visible.State1="false" visible.State2="false" visible.State3="true"/>
+
+ </s:Group>
+
+ <s:transitions>
+ <s:Transition id="mainTransition" fromState="*" toState="*" autoReverse="{autoReverse_check.selected}"
+ interruptionBehavior="{IB_check.selectedItem}">
+ <s:Parallel>
+ <s:Wipe duration="3500" target="{group1}" direction="down" />
+ </s:Parallel>
+ </s:Transition>
+ </s:transitions>
+</s:Group>
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/WipeTemplate.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/WipeTemplate.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/WipeTemplate.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/WipeTemplate.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,97 @@
+<?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.
+
+-->
+<c:TransitionTemplate 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:c="comps.*"
+ width="500" height="300" initialize="onInit()">
+ <fx:Script>
+ <![CDATA[
+ import flash.display.BitmapData;
+ import flash.geom.Rectangle;
+
+ import mx.core.IUIComponent;
+ import mx.events.EffectEvent;
+ import mx.events.FlexEvent;
+
+ import spark.utils.BitmapUtil;
+
+ private var bmData:BitmapData;
+ private var bounds:Rectangle;
+
+ protected function onInit():void
+ {
+ this.valueFunction = getChange;
+ this.initTrans = initMove;
+ this.returnTrans = returnMove;
+ }
+
+ protected function getChange() : Number {
+ for(var x:int = 0; x < 400; x++){
+ if(bmData.getPixel(x,25) == 0x00FFFF){
+ return x;
+ }
+ }
+ return 400;
+ }
+
+ override public function effectUpdate(event:EffectEvent):void {
+ bounds = new Rectangle();
+ bmData = BitmapUtil.getSnapshot(IUIComponent(target), bounds, true);
+ super.effectUpdate(event);
+ }
+ ]]>
+ </fx:Script>
+
+ <fx:Declarations>
+ <s:Transition id="initMove" fromState="One" toState="Two" autoReverse="true">
+ <s:Wipe target="{target}" duration="1000" direction="left"
+ effectStart="effectStart(event)"
+ effectEnd="effectEnd(event)"
+ effectUpdate="effectUpdate(event)"
+ effectStop="effectStop(event)"
+ effectRepeat="effectRepeat(event)"
+ />
+ </s:Transition>
+ <s:Transition id="returnMove" fromState="Two" toState="One" autoReverse="true">
+ <s:Wipe target="{target}" duration="2000" direction="right"
+ effectStart="effectStart(event)"
+ effectEnd="effectEnd(event)"
+ effectUpdate="effectUpdate(event)"
+ effectStop="effectStop(event)"
+ effectRepeat="effectRepeat(event)"
+ />
+ </s:Transition>
+ </fx:Declarations>
+ <c:states>
+ <s:State name="One"/>
+ <s:State name="Two"/>
+ </c:states>
+ <s:Group id="target" y="50" x="50">
+ <s:Rect id="rect" width="400" height="50">
+ <s:fill.One>
+ <s:SolidColor color="#0000FF"/>
+ </s:fill.One>
+ <s:fill.Two>
+ <s:SolidColor color="#00FFFF"/>
+ </s:fill.Two>
+ </s:Rect>
+ </s:Group>
+</c:TransitionTemplate>
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/AddRemoveMonitor.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/AddRemoveMonitor.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/AddRemoveMonitor.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/AddRemoveMonitor.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,75 @@
+<?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.
+
+-->
+<modules:Monitor 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:modules="comps.modules.*" width="400" height="300">
+ <fx:Script>
+ <![CDATA[
+ import mx.events.EffectEvent;
+ protected var threshold:Number;
+ [Bindable]
+ public var fractionDiff:Number = 0.09;
+
+ private var initialEnd:Number;
+ private var returnEnd:Number;
+
+ private var initialVF:Number;
+ private var returnVF:Number;
+
+ override public function check():void {
+ if(isNaN(threshold)){
+ threshold = initialEnd*fractionDiff;
+ }
+
+ if(Math.abs(initialEnd - returnEnd) > threshold){
+ passed = false;
+ error = "AddRemoveChecker: Add time is not symmetric with remove time! " + initialEnd + " vs. " + returnEnd;
+ trace(error);
+ }else if(initialVF != 6 && returnVF != 3){
+ passed = false;
+ error = "AddRemoveChecker: Add flags indicate items were not added/removed correctly! " + initialVF + " vs. " + returnVF;
+ trace(error);
+ }
+ }
+
+ private function getChange(num:int, vec:Vector.<Number>):int{
+ var initialChange:int = -1;
+ for(var i:int = 0; i < initialValues.length; i++){
+ if(initialValues[i] == num) return i;
+ }
+ return initialChange;
+ }
+
+ override public function effectEnd(event:EffectEvent):void {
+ super.effectEnd(event);
+ if(isReturn){
+ returnEnd = end;
+ returnVF = valueFunction.call(target) as Number;
+ }else{
+ initialEnd = end;
+ initialVF = valueFunction.call(target) as Number;
+ }
+ }
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+</modules:Monitor>
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/AutoReverseFalseChecker.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/AutoReverseFalseChecker.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/AutoReverseFalseChecker.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/AutoReverseFalseChecker.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,40 @@
+<?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.
+
+-->
+<modules:Monitor 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:modules="comps.modules.*" width="400" height="300">
+ <fx:Script>
+ <![CDATA[
+ override public function check():void {
+ super.check();
+ if(!passed) return;
+
+ if(returnUpdates.length > 1){
+ passed = false;
+ error = "Final transition was detected!";
+ trace("AutoReturnFalseChecker: " + error);
+ }
+ }
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+</modules:Monitor>
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/ExplicitReturnChecker.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/ExplicitReturnChecker.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/ExplicitReturnChecker.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/ExplicitReturnChecker.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,53 @@
+<?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.
+
+-->
+<modules:Monitor 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:modules="comps.modules.*" width="400" height="300">
+ <fx:Script>
+ <![CDATA[
+ override public function check():void {
+ super.check();
+ if(!passed) return;
+
+ if(returnUpdates.length <= 1){
+ passed = false;
+ error = "No final transition was detected!";
+ trace("ExplicitReturnChecker: " + error);
+ }else{
+ if(Math.abs(initialUpdates.length - returnUpdates.length) <= 2){
+ passed = false;
+ error = "Inital transition was roughly the same period as return transition. Most likely autoReturn behavior overrode explicit transition.";
+ trace("ExplicitReturnChecker: " + error);
+ }else{
+ if(Math.abs((initialUpdates.length * 2) - returnUpdates.length) <= 4){
+ passed = true;
+ }else{
+ passed = true;
+ trace("ExplicitReturnChecker: Warning! Adjust timing of Explicit Return Transition tests for optimum detection!");
+ }
+ }
+ }
+ }
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+</modules:Monitor>
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/Monitor.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/Monitor.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/Monitor.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/Monitor.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,156 @@
+<?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.
+
+-->
+<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx"
+ preinitialize="preInit()">
+ <!--
+ This is the base class for all of the monitors. The idea behind monitors is to provide plugable testing:
+ Essentially, monitors do the actual operations of detecting whether or not something is behaving based on a pre-
+ defined criteria (e.g. symmetric change) without actually interfacing with the thing being tested directly. This
+ enables them to be swapped in at runtime by Mustella without needing to create seperate files for each test.
+ -->
+ <fx:Script>
+ <![CDATA[
+ import mx.collections.ArrayList;
+ import mx.core.IFlexDisplayObject;
+ import mx.events.CloseEvent;
+ import mx.events.EffectEvent;
+ import mx.events.FlexEvent;
+
+ protected var timer:Timer;
+ public var start:int;
+ public var stop:int;
+ public var end:int;
+ public var repeat:int;
+
+ [Bindable]
+ public var initialValues:Vector.<Number>;
+ protected var initialUpdates:Vector.<Number>;
+
+ [Bindable]
+ public var returnValues:Vector.<Number>;
+ protected var returnUpdates:Vector.<Number>;
+
+ [Bindable]
+ public var isReturn:Boolean;
+
+ [Bindable]
+ public var valueFunction:Function;
+ [Bindable]
+ public var target:Object;
+ [Bindable]
+ public var passed:Boolean;
+ [Bindable]
+ public var error:String;
+
+ public function preInit():void{
+ timer = new Timer(20);
+ initialValues = new Vector.<Number>();
+ initialUpdates = new Vector.<Number>();
+
+ returnValues = new Vector.<Number>();
+ returnUpdates = new Vector.<Number>();
+
+ isReturn = false;
+ passed = true;
+ }
+
+ public function effectStart(event:EffectEvent):void{
+ timer.start();
+ start = timer.currentCount * 20;
+ }
+
+ public function effectStop(event:EffectEvent):void{
+ stop = timer.currentCount * 20;
+ timer.stop();
+ }
+
+ public function effectUpdate(event:EffectEvent):void{
+ if(isReturn){
+ returnValues.push(valueFunction.call(target) as Number);
+ returnUpdates.push((timer.currentCount * 20) - start);
+ }else{
+ initialValues.push(valueFunction.call(target) as Number);
+ initialUpdates.push((timer.currentCount * 20) - start);
+ }
+ }
+
+ public function effectEnd(event:EffectEvent):void{
+ end = timer.currentCount * 20;
+ timer.stop();
+ }
+
+ public function effectRepeat(event:EffectEvent):void{
+ repeat++;
+ }
+
+ public function resetMonitors():void {
+ start = 0;
+ stop = 0;
+ repeat = 0;
+ end = 0;
+ }
+
+ protected function computeDeltas(vector:Vector.<Number>):Vector.<Number> {
+ var diff:Vector.<Number> = new Vector.<Number>();
+ var prev:Number = Number.NaN;
+ for each(var n:Number in vector){
+ if(!isNaN(prev)){
+ diff.push(Math.abs(n - prev));
+ }
+ prev = n;
+ }
+
+ return diff;
+ }
+
+ protected function computeRates(values:Vector.<Number>,times:Vector.<Number>):Vector.<Number> {
+ var rates:Vector.<Number> = new Vector.<Number>();
+ var deltaV:Vector.<Number> = computeDeltas(values);
+ var deltaT:Vector.<Number> = computeDeltas(times);
+
+ for(var i:int = 0; i < deltaV.length; i++){
+ var deltaVNum:Number = deltaV.pop();
+ var deltaTNum:Number = deltaT.pop();
+
+ if(deltaTNum != 0){
+ if(deltaVNum == 0){
+ rates.push(0);
+ }else{
+ rates.push(deltaVNum / deltaTNum);
+ }
+ }
+ }
+
+ return rates.reverse();
+ }
+
+ public function check():void {
+ if(Math.abs(initialValues[0] - initialValues[initialValues.length - 1]) < 0.5){
+ passed = false;
+ error = "Initial value is not substantially different from end value in the first transition. " + initialValues[0] + " vs. " + initialValues[initialValues.length - 1];
+ trace("Monitor: " + error);
+ }
+ }
+ ]]>
+ </fx:Script>
+ <s:Label id="readout" text="Passed: {passed}"/>
+</s:Group>
\ No newline at end of file
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/RepeatChecker.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/RepeatChecker.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/RepeatChecker.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/RepeatChecker.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,72 @@
+<?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.
+
+-->
+<m:Monitor xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:m="comps.modules.*"
+ xmlns:mx="library://ns.adobe.com/flex/mx">
+ <fx:Script>
+ <![CDATA[
+ import mx.events.EffectEvent;
+
+ protected var threshold:Number;
+ [Bindable]
+ public var fractionDiff:Number = 0.11;
+
+ public var initialRepTime:Number;
+ public var returnRepTime:Number;
+
+ override public function check():void {
+ super.check();
+ if(!passed) return;
+
+ if(isNaN(threshold)){
+ threshold = Math.abs((initialUpdates[initialUpdates.length - 1] - initialUpdates[0])*fractionDiff);
+ }
+
+ if(returnRepTime > initialRepTime){
+ if(returnRepTime > initialRepTime + threshold){
+ passed = false;
+ error = "RepeatChecker: FAILED! Time at return repeat point is greater than time at initial repeat point. " + returnRepTime + " vs. " + initialRepTime;
+ trace(error);
+ return;
+ }
+ }else{
+ if(returnRepTime < initialRepTime - threshold){
+ passed = false;
+ error = "RepeatChecker: FAILED! Time at return repeat point is less than time at initial repeat point. " + returnRepTime + " vs. " + initialRepTime;
+ trace(error);
+ return;
+ }
+ }
+ }
+
+ override public function effectRepeat(event:EffectEvent):void{
+ if(isReturn){
+ returnRepTime = (timer.currentCount * 20) - start;
+ }else{
+ initialRepTime = (timer.currentCount * 20) - start;
+ }
+ }
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+</m:Monitor>
Added: incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/SymmetryChecker.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/SymmetryChecker.mxml?rev=1370370&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/SymmetryChecker.mxml (added)
+++ incubator/flex/trunk/mustella/tests/mx/states/Transition/SWFs/comps/modules/SymmetryChecker.mxml Tue Aug 7 17:13:06 2012
@@ -0,0 +1,105 @@
+<?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.
+
+-->
+<m:Monitor xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:m="comps.modules.*"
+ xmlns:mx="library://ns.adobe.com/flex/mx">
+ <fx:Script>
+ <![CDATA[
+ protected var threshold:Number;
+ [Bindable]
+ public var fractionDiff:Number = 0.11;
+ /*
+ * Human reaction time is 190 milliseconds to detect a visual stimulus. Frames update every 20 milliseconds.
+ * So, in order for someone to notice a difference, something has to be "off" for 10 frames. This method
+ * goes through and collects 200 milliseconds of frames, then makes sure they're not off by more than
+ * ~11% of the total range of action, which is the experimentally determined max difference between two
+ * occurances of the same transition.
+ */
+ override public function check():void {
+ super.check();
+ if(!passed) return;
+
+ if(isNaN(threshold)){
+ threshold = Math.abs((initialValues[initialValues.length - 1] - initialValues[0])*fractionDiff);
+ }
+
+ returnValues = returnValues.reverse();
+ returnUpdates = returnUpdates.reverse();
+
+ if(Math.abs(returnValues[0] - initialValues[0]) > Math.abs(returnValues[returnValues.length -1] - initialValues[0])){
+ passed = false;
+ error = "SymmetryChecker: Values indicate return path was identical to initial path!";
+ trace(error);
+ return;
+ }
+
+ for(var i:int = 0; i < initialValues.length || i < returnValues.length; i++){
+ var iSlice:int = 0;
+ for(var ii:Number = 0; ii < 200; iSlice++, ii = initialUpdates[i + iSlice] - initialUpdates[i]){
+ if((i + iSlice + 1) >= initialValues.length){
+ return;
+ }
+ }
+
+ var rSlice:int = 0;
+ for(var ri:Number = 0; ri < 200; rSlice++, ri = returnUpdates[i] - returnUpdates[i + rSlice]){
+ if((i + rSlice + 1) >= returnValues.length){
+ return;
+ }
+ }
+
+ var iValues:Vector.<Number> = initialValues.slice(i,i+iSlice);
+ var rValues:Vector.<Number> = returnValues.slice(i,i+rSlice);
+
+ var iStart:Number = iValues.shift();
+ var iSum:Number = 0;
+ for(var iN:Number=0; iN < iValues.length; iN++){
+ //trace("Slice " + i + ", init value " + iN + " = " + (iValues[iN] - iStart) + ".");
+ iSum = iSum + (iValues[iN] - iStart);
+ }
+
+ var rStart:Number = rValues.shift();
+ var rSum:Number = 0;
+ for(var rN:Number = 0; rN < rValues.length; rN++){
+ //trace("Slice " + i + ", return value " + rN + " = " + (rValues[rN] - rStart) + ".");
+ rSum = rSum + (rValues[rN] - rStart);
+ }
+
+ iSum = iSum / (iValues.length + 1);
+ rSum = rSum / (rValues.length + 1);
+
+ if(Math.abs(iSum - rSum) > threshold){
+ passed = false;
+ trace("SymmetryChecker: FAILED! Value " + Math.abs(iSum - rSum) + " is greater than " + threshold + " at time " + (i*20));
+ return;
+ }else{
+ //trace("-> Slice " + i + " difference of " + Math.abs(iSum - rSum) + ".");
+ }
+ }
+
+ passed = true;
+ }
+ ]]>
+ </fx:Script>
+ <fx:Declarations>
+ <!-- Place non-visual elements (e.g., services, value objects) here -->
+ </fx:Declarations>
+</m:Monitor>