A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Event dispatcher getting cut off

  1. #1
    Junior Member
    Join Date
    Oct 2008
    Posts
    26

    Event dispatcher getting cut off

    I have two movieclips: MovieClip X and MovieClip Y.

    MovieClip Y is nested inside of MovieClip X. MovieClip Y contains buttons with listeners attached to them. These listeners call a method
    Code:
    buttonClickedHandler();
    inside of buttonClickedHandler();... dispatchEvent() is called to dispatch a custom event that bubbles up to MovieClip X. This chain of events works as intended, I can set up a listener in MovieClip X for the custom event and everything is fine...

    The problem comes when I try to invoke a dispatch on a button in MovieClip Y without actually physically clicking it. If i call
    Code:
    ButtonA.dispatchEvent(new MouseEvent(MouseEvent.click));
    the listener for the button click event will fire properly, and if i trace the dispatchEvent of the custom event, it returns true meaning the event was dispatched successfully. But in MovieClip X... the listener for that custom event is never fired, its as if the custom even is not bubbling.
    //peace.*

  2. #2
    Junior Member
    Join Date
    Oct 2008
    Posts
    26

    Resolved

    I should have put more thought into this before posting... I was dispatching button event in the constructor of MovieClip Y... it wasnt added to the stage yet. Moving the event dispatching into an added to stage handler ended up resolving this problem
    //peace.*

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