我正在努力让我的动画工作,在屏幕的单独区域唤起一种状态,在悬停时出现/消失,并在单击时转到其他地方,然而,如果你单击它一瞬间就会出现,然后返回到开始。有什么建议吗?
//mouse overs (i've only left 1 instance of each event listener here)
comic.addEventListener(MouseEvent.MOUSE_OVER,BubbleHover);
//mouse outs
comic.addEventListener(MouseEvent.MOUSE_OUT,BubbleOut);
//mouse down
comic.addEventListener(MouseEvent.CLICK,BubbleClick);
//
// Take the playhead to where the user hovers.
//
function BubbleHover(evtObj:MouseEvent) {
var LabelName:String = evtObj.target.name + "Bubble";
trace(evtObj.target.name +" bubble appeared"); //state which bubble appears
//go to the section clicked on...
gotoAndStop(LabelName);
}
//
// Return to the beginning bubble
//
function BubbleOut(evtObj:Event):void{
gotoAndStop("lookBubble");
}
//
// Go to the Label Page
//
function BubbleClick(evtObj:Event){
var MovieClipPage = evtObj.target.name +"_page";
if (mouseEnabled) {
mouseEnabled=false;
trace(mouseEnabled); // returns false but then returns to "lookBubble"
}
gotoAndStop(MovieClipPage);
mouseEnabled(true);
}据我所知,当播放头到达BubbleClick标签时,MouseEvent.MOUSE_OUT就发生了。你知道我怎么才能绕过这个吗?
发布于 2012-08-18 15:27:01
是的,不幸的是,您似乎发现了actionscript中为数不多的怪癖之一。问题是,如果影片剪辑有鼠标输出事件,并且鼠标在该对象上。如果您将mouseEnabled和mouseChildren设置为false,这并不重要,该out事件仍将触发。
处理此问题的方法是使用一些bool (isReallyEnabled)手动检查状态,或者删除事件侦听器。
https://stackoverflow.com/questions/11948977
复制相似问题