在我的应用程序中,我有一个连接到鼠标的鼠标光标。然而,它不允许我单击应用程序中的按钮,这对我来说是一个大问题,因为按钮对于我需要做的事情至关重要。
我是 AS 新手,因此我们将不胜感激!
stage.addEventListener(MouseEvent.MOUSE_MOVE, draw_cursor);
stage.addEventListener(Event.MOUSE_LEAVE, hide_cursor);
Mouse.hide();
function draw_cursor(event:MouseEvent):void
{
my_cursor_mc.visible = true;
my_cursor_mc.x = event.stageX;
my_cursor_mc.y = event.stageY;
}
function hide_cursor(event:Event):void
{
my_cursor_mc.visible=false;
}
我尝试使用这个(如下),但非常棘手,必须按下按钮才能使光标消失然后我能够单击该按钮(不太理想):
stage.addEventListener(MouseEvent.CLICK, hide_cursor);
听起来你的光标可能正在窃取按钮的鼠标事件。在您的顶级代码(或构造函数)中尝试添加:
// Disable mouse events for cursor
my_cursor_mc.mouseEnabled = false;
如果鼠标事件有任何子对象还添加:
// Disable mouse events for any children of the cursor
my_cursor_mc.mouseChildren = false;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)