Hi guys,
I’m having some trouble with events. My application has a class structure similar to below.
-Main (Document Class)
— BodyContainer
------ BodyTextContainer
------ ImagesContainer
— ContentsContainer
------ SectionsContainer
------ SubsectionContainer
The App has a list of manuals to be displayed. This is handled by the Main class. When the user clicks on a manual an instance of ContentsContainer is loaded. This lists all the sections in the selected manual. When the user selectes a section to view, the SubsectionsContainer is updated. When they choose a subsection a custom event is dispatched to be received by Main, the ContentsContainer class should be removed and the BodyContainer should be instantiated to display the information in that subsection.
So I want to dispatch an event from SubsectionContainer that is received by Main that removes ContentsContainer and loads BodyContainer.
I can’t seem to get Main to respond to the event. Is this possible? It onty seems to work if I add an event listener in Main that is linked directly to the subsection container:
ContentsContainer.SubsectionContainer.addEventListener(…)
But obviously I don’t want to be hard coding like this in my app. Hope that all makes sense. Anyone got any advice?
Thanks very much!