Flex中的(handCursor)手型鼠标及mouseChildren属性

Flex里很多控件的手型鼠标可以用如下方式实现:

buttonMode="true" 或 useHandCursor="true" 或者两个一起。

但是Label和其他一些控件我一直搞不定。

 

今天终于发现,Label需要设置为:

buttonMode="true"  mouseChildren="false"

 

 

去帮助里找到了mouseChildren这个属性。大意如下:

mouseChildren这个属性控制的是该控件是否能够让用户通过鼠标来交互,即触发鼠标事件。默认为true。

 

如果想用自定义的Sprite作为button使用,就可能需要这个属性。因为Sprite中可能会包含其他子控件,为了让该Sprite作为一个整体来响应交互动作,就需要屏蔽其子控件的MouseEvent响应。也就是需要把子控件的mouseChildren=false。

 

这个属性和Label的关系, 难道说明Label本身是一个特殊的组合的Sprite?

 

 

 

mouseChildren property

mouseChildren:Boolean   [read-write]

Determines whether or not the children of the object are mouse enabled. If an object is mouse enabled, a user can interact with it by using a mouse. The default is true .

This property is useful when you create a button with an instance of the Sprite class (instead of using the SimpleButton class). When you use a Sprite instance to create a button, you can choose to decorate the button by using the addChild() method to add additional Sprite instances. This process can cause unexpected behavior with mouse events because the Sprite instances you add as children can become the target object of a mouse event when you expect the parent instance to be the target object. To ensure that the parent instance serves as the target objects for mouse events, you can set the mouseChildren property of the parent instance to false .

No event is dispatched by setting this property. You must use the addEventListener() method to create interactive functionality.

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值