A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: accessing Parent Movieclip, dispatchEvent

Threaded View

  1. #1
    Member
    Join Date
    Jul 2009
    Location
    Florianópolis
    Posts
    81

    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!
    Last edited by ziriguidum; 01-19-2010 at 09:33 AM. Reason: add stuff

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center