PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: inconduit on December 03, 2010, 06:28:00



Title: flex 4 and ApplicationMediator
Post by: inconduit on December 03, 2010, 06:28:00
i'm switching from flex 3 to flex 4 and i'm hitting a few snags.

i create all my mediators in ApplicationMediator.  in flex 3, i listened for the ADDED_TO_STAGE event in ApplicationMediator to get references to all the instantiated views in the app.  now in flex 4, i get null references on a lot of the views within that added_to_stage event.

i'm probably missing something very basic here, but haven't been able to figure it out.  what event should i be listening to with ApplicationMediator to ensure that all of my views in the app are instantiated?


Title: Re: flex 4 and ApplicationMediator
Post by: puremvc on December 05, 2010, 10:50:46
If you don't startup your PureMVC app until after applicationComplete, then all of your children that aren't deferred1 should be created by the time ApplicationMediator is registered. Which means in its onRegister you should be able to wrap Mediators around those children by name. Most ADDED_TO_STAGE events would be dispatched during the creation of the app before applicationComplete.

Can you tell us a little more about your startup timing?

-=Cliff>

1  i.e. unseen children of a ViewStack whose creationPolicy isn't 'all'


Title: Re: flex 4 and ApplicationMediator
Post by: inconduit on January 06, 2011, 04:26:53
i never replied to this and i should have.

thanks cliff for the response, indeed i needed to wait until after applicationComplete before doing all of my mediator instantiation.  why i was triggering on added_to_stage i don't really know, i think it was just very old code that i wrote when i was just learning puremvc.