I'm working on a project that has multiple clickable objects on the stage.
However, when I create the following function, I getting the last defined eventlistener .
// Event listeners
antwoordBox1.addEventListener(MouseEvent.CLICK, antwoordboxclick);
antwoordBox2.addEventListener(MouseEvent.CLICK, antwoordboxclick);
function antwoordboxclick(event:MouseEvent):void {
trace (event.currentTarget.name); // traces 'antwoordBox2' , whether I click any of the buttons.
if (event.currentTarget.name == 'antwoordBox1') {
trace('antwoordBox1 selected');
}
if (event.currentTarget.name == 'antwoordBox2') {
trace('antwoordBox2 selected');
}
currentQuestion++; // function to handle after above
trekNieuweVraag(); // another function to handle after above
}
// end of my code
Whatever I try, I don't get it fixed. When I use event.target , I get the child movieclip name inside antwoordBox2 (or antwoordBox1) .
Hope anyone can help me! :)
antwoordBox2is not overantwoordBox1. - akmozo