Flex4滚动条与focous out事件

1、 滚动条
flex4中内容超出容器组件的方案
我们在开发中一般会用到s前缀的容器,即spark容器组件,但里面的内容如超过这些容器的大小时并不会产生滚动条,如有下列代码
<s:NavigatorContent label="基本信息" width="100%" height="100%">
<s:HGroup width="100%" height="100%">
<s:layout>
<s:HorizontalLayout useVirtualLayout="true"/>
</s:layout>
<resourcemanagement:HostBasicInfo id="hostBasicInfo" width="98%" height="100%"
dispatcher="{model.dispatcher}" host="{model.hostInfo}"
hostUsage="{model.hostUsageInfo}" hostBasicPhysicalInfo="{model.hostBasicPhysicalInfo}"/>
</s:HGroup>
</s:NavigatorContent>
这里NavigatorContent里面的内容过多,会出现内容直接超出NavigatorContent的现象

查阅flex4文档后发现可以采用下面的办法解决
<s:NavigatorContent label="基本信息" width="100%" height="100%">
<s:Scroller left="0" right="0" top="0" bottom="0" horizontalScrollPolicy="off">
<s:Group width="100%" height="100%">
<s:layout>
<s:HorizontalLayout useVirtualLayout="true"/>
</s:layout>
<resourcemanagement:HostBasicInfo id="hostBasicInfo" width="98%" height="100%"
dispatcher="{model.dispatcher}" host="{model.hostInfo}"
hostUsage="{model.hostUsageInfo}" hostBasicPhysicalInfo="{model.hostBasicPhysicalInfo}"/>
</s:Group>
</s:Scroller>
</s:NavigatorContent>
即在需要滚动条的容器里面放入s:Scroller组件,将原来的内容放入s:Scroller组件内部(注意需要设置s:Scroller组件的子组件useVirtualLayout属性)

2、在弹出窗体中使用foucus out事件时建议
if(number == null) {
this.addEventListener(FlexEvent.CREATION_COMPLETE,function():void {
number.addEventListener(FocusEvent.FOCUS_OUT,checkNumberExist);
location.addEventListener(FocusEvent.FOCUS_OUT,getLatLngByLocation);
});
}else {
number.addEventListener(FocusEvent.FOCUS_OUT,checkNumberExist);
location.addEventListener(FocusEvent.FOCUS_OUT,getLatLngByLocation);
}
注意:checkNumberExist函数中含FocusEvent参数
而非:
<mx:FormItem label="编码:" required="true" focusEnabled="true" width="100%">
<s:TextInput id="number" width="100%" enabled.addView="true" enabled.editView="false" text="@{_datacenter.number}"/>
</mx:FormItem>

至于原因吗自己试试便知
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值