首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >mouseEnabled + MOUSE_OVER冲突

mouseEnabled + MOUSE_OVER冲突
EN

Stack Overflow用户
提问于 2012-08-14 17:01:01
回答 1查看 191关注 0票数 0

我正在努力让我的动画工作,在屏幕的单独区域唤起一种状态,在悬停时出现/消失,并在单击时转到其他地方,然而,如果你单击它一瞬间就会出现,然后返回到开始。有什么建议吗?

代码语言:javascript
复制
//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就发生了。你知道我怎么才能绕过这个吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-08-18 15:27:01

是的,不幸的是,您似乎发现了actionscript中为数不多的怪癖之一。问题是,如果影片剪辑有鼠标输出事件,并且鼠标在该对象上。如果您将mouseEnabled和mouseChildren设置为false,这并不重要,该out事件仍将触发。

处理此问题的方法是使用一些bool (isReallyEnabled)手动检查状态,或者删除事件侦听器。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11948977

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档