0

我正在努力使我的动画工作,其中屏幕的单独区域会唤起在悬停时出现/消失的状态,并且如果单击则转到其他地方,如果您单击它一秒钟就会出现转到该标签,然后返回到开始。有什么建议么?

//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正在发生。有什么想法可以绕过这个吗?

4

1 回答 1

0

是的,不幸的是,您似乎在 actionscript 中发现了少数怪癖之一。问题在于,如果影片剪辑具有鼠标退出事件并且鼠标位于该对象上方。将 mouseEnabled 和 mouseChildren 设置为 false 无关紧要,out 事件仍会触发。

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

于 2012-08-18T07:27:00.900 回答