accessing Parent Movieclip, dispatchEvent
help! i have a menu class that creates a menu dinamically.
I want the main class (the one that loads the menu) to re- position the menu, but it has to do it after the menu is created so at this point the menu has its final width.
I ´ve told the menu to dispatch an event but the main class doesn´t listen:
Code:
// menu.as:
dispatchEvent(new Event("MENU_COMPLETED"));
// main.as:
addEventListener("MENU_COMPLETED", placeMenu);
private function placeMenu(e:Event):void
{
trace ("hello!"); // nothing happens
}
i´ve tried to access the main class in the menu but it throws null.
Code:
// menu.as
trace (MovieClip(parent)); // throws null
trace (parent); // throws null
please help! thanks!