| <?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. |
| |
| --> |
| <mx:VBox width="100%" height="100%" |
| xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark" |
| xmlns:boxes="AnimalBoxes.*" > |
| |
| <fx:Script> |
| <![CDATA[ |
| import mx.events.ItemClickEvent; |
| import mx.events.StateChangeEvent; |
| |
| private function changeState(event:ItemClickEvent):void{ |
| currentState = event.currentTarget.selectedValue; |
| } |
| |
| // 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 doManualResetState():void{ |
| if(currentState == "CatState"){ |
| dispatchEvent(new Event("manualResetStateComplete")); |
| }else{ |
| addEventListener("currentStateChange", handleCurrentStateChange); |
| currentState = "CatState"; |
| } |
| } |
| |
| private function handleCurrentStateChange(e:StateChangeEvent):void{ |
| dispatchEvent(new Event("manualResetStateComplete")); |
| } |
| |
| ]]> |
| </fx:Script> |
| |
| <mx:states> |
| <mx:State name="CatState" /> |
| <mx:State name="DogState" /> |
| <mx:State name="CattleState" /> |
| <mx:State name="PigState" /> |
| </mx:states> |
| |
| <mx:TabNavigator id="tnMain" width="100%" height="100%"> |
| <mx:Box id="bxContents" label="Main"> |
| <mx:Text text="Select the animal you'd like information on:" /> |
| <mx:RadioButtonGroup id="rbgAnimals" itemClick="changeState(event)" /> |
| <mx:RadioButton id="rbCats" groupName="rbgAnimals" label="Cats" value="CatState" selected="true" /> |
| <mx:RadioButton id="rbDogs" groupName="rbgAnimals" label="Dogs" value="DogState" /> |
| <mx:RadioButton id="rbCattle" groupName="rbgAnimals" label="Cattle" value="CattleState" /> |
| <mx:RadioButton id="rbPigs" groupName="rbgAnimals" label="Pigs" value="PigState" /> |
| </mx:Box> |
| |
| <boxes:CatCareBox id="bxCatCare" includeIn="CatState" /> |
| <boxes:KittenCareBox id="bxKittenCare" includeIn="CatState" /> |
| <boxes:CatBreedBox id="bxCatBreeds" includeIn="CatState" /> |
| |
| <boxes:DogCareBox id="bxDogCare" includeIn="DogState" /> |
| <boxes:PuppyCareBox id="bxPuppyCare" includeIn="DogState" /> |
| <boxes:DogBreedBox id="bxDogBreeds" includeIn="DogState" /> |
| |
| <boxes:CattleCareBox id="bxCattleCare" includeIn="CattleState" /> |
| <boxes:CalfCareBox id="bxCalfCare" includeIn="CattleState" /> |
| <boxes:CattleBreedBox id="bxCattleBreeds" includeIn="CattleState" /> |
| |
| <boxes:PigCareBox id="bxPigCare" includeIn="PigState" /> |
| <boxes:PigletCareBox id="bxPigletCare" includeIn="PigState" /> |
| <boxes:PigBreedBox id="bxPigBreeds" includeIn="PigState" /> |
| </mx:TabNavigator> |
| |
| </mx:VBox> |