Flex4中 超出容器边界的子项没有隐藏

在flex4中,因为必须添加<s:Scroller/>标签才能出现滚动条,所以如果如果一个容器例如Panel没有添加滚动条,那么添加到Panel中的child的位置如果超出了Panel的边界,那么这个child就不会隐藏。

 

如果不想添加滚动条,并且让子类在超出边界时隐藏掉,只要在给容器设置layout并且设置layout的clipAndEnableScrolling为true即可。

例子:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
			   currentState="show">
	<fx:Declarations>
		<s:Sine id="sineEasing"
				easeInFraction="0.3"/>
		<s:Move id="hideMove" target="{targetBox}" xTo="{-200}" duration="1000" easer="{sineEasing}" effectEnd="{currentState = 'hide'}"/>
		<s:Move id="showMove" xTo="0" duration="1000" target="{targetBox}" effectEnd="{currentState = 'show'}"/>
		
	</fx:Declarations>
	<s:states>
		<s:State name="show"/>
		<s:State name="hide"/>
	</s:states>
	<s:Panel title="Move Effect Example" 
			 id="testPanel"
			 x="100"
			 width="75%" height="75%">
		<s:layout>
			<s:BasicLayout clipAndEnableScrolling="true"/>
		</s:layout>
			<s:VGroup id="targetBox" width="50%">
				<s:HGroup>
					<s:Panel title="test move" width="200" height="200" id="testpanel">
						<s:TextArea text="clipContent值:True:当子项目的边界超出此容器时,不显示子项目在此容器中。Flase:当子项目的边界超出此容器时,显示子项目在此容器中。"/>
					</s:Panel>
					<s:Button height="200" 
							  width="40"
							  click.show="{hideMove.play()}"
							  click.hide="{showMove.play()}"/>	
				</s:HGroup>
			</s:VGroup>
	</s:Panel>
</s:Application>
 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值