加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flex tree expandItem

发布时间:2020-12-15 04:18:57 所属栏目:百科 来源:网络整理
导读:?xml version="1.0" encoding="utf-8"? !-- http://yecon.blog.hexun.com/30749527_d.html? -- !-- http://www.slsay.com -- mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" ??????? layout="vertical" ??????? verticalAlign="middle" ???????

<?xml version="1.0" encoding="utf-8"?>
<!-- http://yecon.blog.hexun.com/30749527_d.html? -->
<!-- http://www.slsay.com --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" ??????? layout="vertical" ??????? verticalAlign="middle" ??????? backgroundColor="white"> ??? <mx:Script> ??????? <![CDATA[ ??????????? import mx.events.ListEvent; ??????????? private function comboBox_change(evt:ListEvent):void { ??????????????? var team:String = ComboBox(evt.currentTarget).selectedItem.@label; ??????????????? var node:XMLList = mlb.league.division.team.(@label == team); ??????????????? expandParents(node[0]); ??????????????? tree.selectedItem = node[0]; ??????????????? var idx:int = tree.getItemIndex(node[0]); ??????????????? tree.scrollToIndex(idx); ??????????? } ??????????? private function expandParents(node:XML):void { ??????????????? if (node && !tree.isItemOpen(node)) { ??????????????????? tree.expandItem(node,true); ??????????????????? expandParents(node.parent()); ??????????????? } ??????????? } ??????? ]]> ??? </mx:Script> ??? <mx:XML id="mlb" source="mlb.xml" /> ??? <mx:ApplicationControlBar dock="true"> ??????? <mx:ComboBox id="comboBox" ??????????????? prompt="Please select a team..." ??????????????? dataProvider="{mlb.league.division.team}" ??????????????? labelField="@label" ??????????????? change="comboBox_change(event);" /> ??? </mx:ApplicationControlBar> ??? <mx:Tree id="tree" ??????????? dataProvider="{mlb}" ??????????? labelField="@label" ??????????? showRoot="false" ??????????? width="300" ??????????? rowCount="8" /> </mx:Application>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读