I’ve created a container called “menu_container” and a child object called “hitbox” within it. When I add AddEventListener to the hitbox, it doesn’t call the specified function at all. Here is the code:
// Create Container
var menu_container:MovieClip = new MovieClip();
addChild(menu_container);
// Create hitBox
var hitbox:Shape = new Shape();
hitbox.name = "hitbox";
hitbox.graphics.beginFill(0xFFFFFF);
hitbox.graphics.drawRect(0, 0, 250, 100);
hitbox.graphics.endFill();
menu_container.addChild(hitbox);
menu_container.getChildByName("hitbox").addEventListener(MouseEvent.MOUSE_OVER, moveIconMenu);
function moveIconMenu(e:Event):void {
trace("hello");
}
Can anybody explain this? I’m completely stumped… Thanks for your time.