Apache flex Flex:显示/隐藏使用HDividedBox划分的VBox
我有两个通过HDividedBox分割的vbox。双击HDividedBox是否可以显示或隐藏其中一个VBox?Apache flex Flex:显示/隐藏使用HDividedBox划分的VBox,apache-flex,Apache Flex,我有两个通过HDividedBox分割的vbox。双击HDividedBox是否可以显示或隐藏其中一个VBox? 我知道如何使用moveDivider()和getDividerAt()方法,但是对于此类问题是否有HDividedBox功能。因此,我建议使用自定义组件而不是HDividedBox;) 特别为您提供-基于事件的组件,它处理双击分隔器(200ms-双击间隔): 使用的示例: <?xml version="1.0" encoding="utf-8"?> <mx:
我知道如何使用
moveDivider()
和getDividerAt()
方法,但是对于此类问题是否有HDividedBox功能。因此,我建议使用自定义组件而不是HDividedBox;)
特别为您提供-基于事件的组件,它处理双击分隔器(200ms-双击间隔):
使用的示例:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*" xmlns:c="mx.containers.*">
<mx:Script>
<![CDATA[
import mx.effects.easing.Cubic;
]]>
</mx:Script>
<mx:AnimateProperty id="hide" easingFunction="{Cubic.easeIn}" target="{to_hide}" property="width" toValue="0" duration="700" />
<c:HDividedBoxD height="100%" width="100%" dividerDoubleClick="hide.play();" >
<mx:VBox height="100%" width="50%" backgroundColor="#00FF00">
<mx:Label text=" some text left 1"/>
<mx:Label text=" some text left 2"/>
</mx:VBox>
<mx:VBox id="to_hide" height="100%" width="50%" backgroundColor="#0000FF">
<mx:Label text=" some text right 3"/>
<mx:Label text=" some text right 4"/>
</mx:VBox>
</c:HDividedBoxD>
</mx:Application>
您可以根据需要修改该模块。我只想谢谢:)
package mx.containers
{
import flash.events.Event;
public class DividerDblClickEvent extends Event{
// Define static constant.
public static const DOUBLE_CLICK:String = "dividerDoubleClick";
public var dividerIndex:int = -1; // not set
public function DividerDblClickEvent(type:String, dividerIndex:int = -1, bubbles:Boolean=false, cancelable:Boolean=false){
super(type, bubbles, cancelable);// Call the constructor of the superclass.
this.dividerIndex = dividerIndex;// Set the new property.
}
// Override the inherited clone() method.
override public function clone():Event {
return new DividerDblClickEvent(type, dividerIndex);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*" xmlns:c="mx.containers.*">
<mx:Script>
<![CDATA[
import mx.effects.easing.Cubic;
]]>
</mx:Script>
<mx:AnimateProperty id="hide" easingFunction="{Cubic.easeIn}" target="{to_hide}" property="width" toValue="0" duration="700" />
<c:HDividedBoxD height="100%" width="100%" dividerDoubleClick="hide.play();" >
<mx:VBox height="100%" width="50%" backgroundColor="#00FF00">
<mx:Label text=" some text left 1"/>
<mx:Label text=" some text left 2"/>
</mx:VBox>
<mx:VBox id="to_hide" height="100%" width="50%" backgroundColor="#0000FF">
<mx:Label text=" some text right 3"/>
<mx:Label text=" some text right 4"/>
</mx:VBox>
</c:HDividedBoxD>
</mx:Application>