新手AS3.0鼠标事件报错问题
A和B两个按钮,要实现,当鼠标放在A上时,B显示,鼠标离开A时,B隐藏;同时点击A时跳转到另一帧。现在功能倒是能实现,但是报错:TypeError:Error#1009:...
A和B两个按钮,要实现,当鼠标放在A上时,B显示,鼠标离开A时,B隐藏;同时点击A时跳转到另一帧。现在功能倒是能实现,但是报错:TypeError: Error #1009: 无法访问空对象引用的属性或方法。at _fla::MainTimeline/fl_MouseOutHandler()
代码如下:
A.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_5);
function fl_MouseClickHandler_5(event:MouseEvent):void
{
gotoAndStop(21);
}
B.visible = false;
A.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverHandler);
function fl_MouseOverHandler(event:MouseEvent):void
{
B.visible = true;
}
A.addEventListener(MouseEvent.MOUSE_OUT, fl_MouseOutHandler);
function fl_MouseOutHandler(event:MouseEvent):void
{
B.visible = false;
} 展开
代码如下:
A.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_5);
function fl_MouseClickHandler_5(event:MouseEvent):void
{
gotoAndStop(21);
}
B.visible = false;
A.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverHandler);
function fl_MouseOverHandler(event:MouseEvent):void
{
B.visible = true;
}
A.addEventListener(MouseEvent.MOUSE_OUT, fl_MouseOutHandler);
function fl_MouseOutHandler(event:MouseEvent):void
{
B.visible = false;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询