I'm having issue to init a menu item inside of CustomEvent. It's weird I can handle any mouseEvents (click, over or out) without any problem. But NOT with Event.INIT or Event.COMPLETE.
For some reason, It doesn't fire... Does anyone know is there a better way to do that?
My code:
private function handleMenu(event:CustomEventCenter):void
{
var menuOption = event._name.menu;
menuOption.addEventListener(MouseEvent.CLICK, handleOptionClicked);
menuOption.addEventListener(Event.INIT, handleInitMenuItem); // It doesn't go through!!
}
private function handleInitMenuItem(event:Event):void
{
var clickedItem:Array = event.target.belongsToMenu;
selectedMenuItem = clickedItem;
// It won't display the trace while using Event.INIT or COMPLETE. However the trace works fine when I use MouseEvent
trace("____selectMenuItem: "+selectedMenuItem[0]);
}
In my Menu class: I defined menuItem is just a MovieClip
dispatchEvent(new CustomEventCenter(CustomEventCenter.OBJECT_USED, { menu:menuItem }));