Your execution probably goes something like this. ( Remember , the thread you have shown is "blocking" ).
Here the content selector is being constructed. Generally , you don't want to do a whole lot in your constructor functions. This is an example of why not.
_contentSelector = new ContentSelector("story");
At the end of that function , an event is dispatched , announcing to the world that something about a ContentSelector has changed !
Now we move up out of scope of the _contentSelector to add the event listener .... AFTER the event has been fired.
If this post was helpful , please mark it as such.
That doesn't really help me. You mostly just reiterated what I did. This solution isn't working. Do you have any idea why?
Use the above line
Actually , what I wrote and what you wrote are different. You add your event listener AFTER the event has been dispatched. An event listener can't listen for events that were fired before it was added.
Have you tried this.
public class ContentSelector extends EventDispatcher
// lazy constructor
public function ContentSelector()
public function setSection( section:String ):void
/// Switch cases galore
dispatchEvent( new Event("ContentSelector.CONTENT_CHANGE") );
Then in your code.
private var _contentSelector:ContentSelector = new ContentSelector();
_contentSelector.addEventListener("ContentSelector.CONTENT_CHANGE" , onContentCompleteChange );
UbuntuPenguin is right, I think you missed out the important part of his post. You are adding the event listener AFTER the event has been dispatched, that's why it can not be catched.