Reputation: 808
The code below doesn't seem to work as expected, I'm not even seeing the trace statement, but I receive no errors. I'm extremely confused!
keyboardMC.button0MC.addEventListener(MouseEvent.CLICK, Button0);
function Button0(mouseEvent:MouseEvent):void {
trace('0');
}
I should also mention that any other code that I put into the function is not executed.
Can anyone see anything wrong with this?
Upvotes: 1
Views: 125
Reputation: 1954
Your code should be working if as Jason Sturges said it's on top of the Display List. Basically check if something is overlayed on that movieclip, it won't take events.
What shaumhusain meant was to do it like this:
stage.addEventListener(MouseEvent.CLICK, OnClickHandler);
function OnClickHandler(e:MouseEvent):void
{
trace(e.target.name);
}
Also check if the parent of that movieclip is mouseEnabled, otherwise it won't work.
Upvotes: 3