niemeyerja
niemeyerja

Reputation: 3

Movieclip contents activating mouse event

I am working on a map with a number of mouse over ''points'' that fades-in movieclip text. The problem I'm experiencing is that the text itself, which is contained in the parent movieclip, becomes a mouse over area also. I just want the point itself to activate the mouse event, not its contents. I have searched all over the web and found "solutions" such as mouseChildren = false; and mouseEnabled = false; do not work. I don't know if I am just coding wrong or what. Any help would be appreciated. Here is the code I have:

clayton.buttonMode = true;
clayton.addEventListener(MouseEvent.ROLL_OVER, over);
clayton.addEventListener(MouseEvent.ROLL_OUT, out);

function over(event:MouseEvent):void{
    clayton.gotoAndPlay("over");

}

function out(event:MouseEvent):void{
    clayton.gotoAndPlay("out"); 
}

After mousing over the parent movie clip, the contained text fades-in correctly. When mousing out of the parent movie clip, the contained text fades-out correctly. However, after having moused over and out of the parent movieclip, the contained text then acts like it's the parent movieclip and activates the mouseover animation. Here is a video showing the actual problem. Notice when I mouse over the central area of the map at the beginning, nothing happens. But after I have moused over the point on the map, the central area then activates the animation.

Here is a video example of my problem: http://www.youtube.com/watch?v=OC2vVjMQTH4

Upvotes: 0

Views: 187

Answers (1)

BadFeelingAboutThis
BadFeelingAboutThis

Reputation: 14406

The video helps!

It looks like what's happening is your info box that comes up on your initial mouse-over stays loaded even after the fade-out, so even though you can't see it (faded out), it's still there and triggering your roll-over.

You could fix this a number of different ways. The quickest (though sloppiest) would be to add an empty frame at the end of your 'out' animation before it stops/loops.

Better practice might be to attach your roll_over listener on the point object itself. (you could leave the roll_out on the parent 'clayton').

Upvotes: 0

Related Questions