关于Flex按钮事件

前几天在做公司的监控点地图项目的时候,老大们提了一个需求,就是在按住地图的导航按钮(类似于GoogleMap左上方的那五个按钮)时,地图会一直向某个方向移动直至按钮松开为止。查了一下MouseEvent类的事件,用MouseEvent.MOUSE_CLICK 与 MouseEvent.MOUSE_DOWN 这两个鼠标事件都无法实现。最后通过查API中的Button类,终于发现:

 

buttonDown: Event

Event Object Type: mx.events.FlexEvent
FlexEvent.type property = mx.events.FlexEvent.BUTTON_DOWN

Dispatched when the user presses the Button control. If the autoRepeat property is true , this event is dispatched repeatedly as long as the button stays down.

The FlexEvent.BUTTON_DOWN constant defines the value of the type property of the event object for a buttonDown event.

意思是说,Button对象有个名为buttonDown的事件,该事件在每次用户按下Button是会被分派(即按钮发出该事件),如果按钮的autoRepeat属性值为true,用户按住按钮时按钮会一直发出该事件。

找到了这个东东,功能就自然而然实现了,呵呵~
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值