`
zhidde
  • 浏览: 3197 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

flex下拉选择树创建,单击节点时不关闭

    博客分类:
  • flex
阅读更多

 

在flex中实现下拉选择树,有很多种方法,比如(代码仅为示例):

1)mx:ComboBox中设置dropdownFactory为mx:Tree或其子类

 

<mx:ComboBox>
	<mx:dropdownFactory>
		<fx:Component >
			<mx:Tree/>
		</fx:Component>
	</mx:dropdownFactory>
</mx:ComboBox>
 

 

2)mx:PopUpButton中设置popUp属性

 

<mx:PopUpButton 
        creationComplete="creationCompleteHandler(event)">
	<fx:Script>
		<![CDATA[
			protected function creationCompleteHandler(event:FlexEvent):void
			{
				var tree:Tree = new Tree();
				this.popUp = tree;
			}]]></fx:script></mx:PopUpButton>

 

 但使用中发现很容易误操作,即下拉选择的时候不小心选中了节点,从而关闭了下拉树,如何阻止呢?

查看源码之后,发现设置PopUpButton的closeOnActivity=false即可,但ComboBox因为相关属性和方法都是私有,实现起来太曲折

 

0
1
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics