| <?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:Application backgroundColor="0xFFFFFF" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark" > |
| |
| <s:layout> |
| <s:VerticalLayout paddingTop="20" paddingLeft="20" gap="20"/> |
| </s:layout> |
| |
| <fx:Script> |
| <![CDATA[ |
| import mx.events.StateChangeEvent; |
| |
| /** |
| * Any test case could start out in any state, depending on how the |
| * previous test failed. Therefore, we cannot switch to a state and |
| * then wait, since we may already be in that state. |
| **/ |
| public function ensureState1():void{ |
| if(currentState == "state1"){ |
| dispatchEvent(new Event("manualResetComplete")); |
| }else{ |
| addEventListener("currentStateChange", handleCurrentStateChange); |
| currentState = "state1"; |
| } |
| } |
| |
| private function handleCurrentStateChange(e:StateChangeEvent):void{ |
| dispatchEvent(new Event("manualResetComplete")); |
| } |
| |
| ]]> |
| </fx:Script> |
| |
| |
| <s:states> |
| <s:State name="state1" /> |
| <s:State name="state2" /> |
| <s:State name="state3" /> |
| </s:states> |
| |
| <s:ToggleSwitch id="ts1" selected.state1="true" selected.state2="false" includeIn="state1,state2"/> |
| <s:Label id="lbl1" text="{ts1.selected.toString()}"/> |
| |
| <s:ToggleSwitch id="ts2" includeIn="state3"/> |
| |
| </s:Application> |