action-script-3 中 MOUSE_OVER 事件监听器的行为
如果在注册 MOUSE_OVER
事件之前和期间鼠标位于某个对象上,该事件是否会触发?我问这个问题是因为它似乎不在我的程序中,并且我想知道这是否是所有 MOUSE_OVER
事件的通用行为。有办法解决这个问题吗?
我将避免在这里给出代码示例,因为我的程序又大又复杂。
If the mouse is over an object before and while a MOUSE_OVER
event is registered, does it trigger? I ask this because it appears that it doesn't in my program, and I want to know if this is a universal behavior of all MOUSE_OVER
events. Is there a way around this?
I'm gonna avoid giving a code example here, because my program is large and complicated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
每当光标进入任何交互式
DisplayObject
(例如Sprite
或MovieClip
)的边界时,都会调度MOUSE_OVER
事件;这包括它的任何子项(如果您想忽略子项,请参阅ROLL_OVER
)。此外,如果对象被添加到舞台并且当前恰好位于光标下方,则该事件将调度。
确保在 Flash Player 分派事件之前已注册事件侦听器非常重要 - 系统事件不会在单个帧之外排队,因此不会为先前的活动调用任何处理程序。
The
MOUSE_OVER
event will dispatch whenever the cursor enters the bounds of any interactiveDisplayObject
, such as aSprite
orMovieClip
; this includes any of its children (seeROLL_OVER
if you wish to ignore children).As well, the event will dispatch in cases where an object is added to the stage and currently happens to be under the cursor.
It is important to make sure that your event listener has been registered before the Flash Player has dispatched the event -- system events are not queued beyond a single frame, and thus no handlers will be invoked for previous activity.