//Here is my code <?xml version="1.0" encoding="utf-8"?> <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="loadAreas()"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; import com.model.Model; public function loadAreas():void{ var ac:ArrayCollection = new ArrayCollection(); for each(var area:Object in Model.instance.vehicleAC){ ac.addItem({name: area.name, children: area.children}); } areaCB.dataProvider = ac; } private function areaChange():void{ teamCB.dataProvider = null; teamCB.dataProvider = areaCB.selectedItem.children; } ]]> </mx:Script> <mx:ComboBox id="areaCB" labelField="name" change="areaChange()"/> <mx:ComboBox id="teamCB" dataProvider="{areaCB.selectedItem.children}" labelField="Team"/> </mx:HBox>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; [Bindable] protected var ac:ArrayCollection = new ArrayCollection([{name:"Bob", children:["bobby", "sally", "billy"]}, {name:"Sarah", children:["angie","kelly"]}, {name:"Sam", children:["sammy","roger","troy", "rich"]}]); ]]> </mx:Script> <mx:ComboBox id="areaCB" labelField="name" dataProvider="{ac}" /> <mx:ComboBox id="teamCB" dataProvider="{areaCB.selectedItem.children}" labelField="Team" /> </mx:HBox>
<?xml version="1.0" encoding="utf-8"?> <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="loadAreas()"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; import com.model.Model; public function loadAreas():void{ var ac:ArrayCollection = new ArrayCollection(); for each(var area:Object in Model.instance.vehicleAC){ ac.addItem({name: area.name, children: area.children}); } areaCB.dataProvider = ac; } ]]> </mx:Script> <mx:ComboBox id="areaCB" labelField="name"/> <mx:ComboBox id="teamCB" dataProvider="{areaCB.selectedItem.children}" labelField="Team"/> </mx:HBox>
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.