Search code examples
actionscript-3eventschildren

AS3: How to catch the event sent from subchild class?


enter image description here

I thought it's a straight forward work but it isn't :(. You can see now how I designed my code. Help please


Solution

  • You have to put the dispatchEvent call in other method, not in the constructor. Maybe on an ADDED_TO_STAGE handler function.

    When you create the Event instance, you have to pass another parameter indicating that the event will be propagated (it is called bubbles in the reference)

    dispatchEvent("ShipCreated", true);