tags:

views:

556

answers:

1

the setup:

have the main mxml file displaying a viewstack of a login panel and a main panel. inside the main panel there is two panels, a form panel and a list panel

On startup, the application mediator and the login mediator are attached to the application panel and to the login panel respectively. on login_successful event, the application mediator attaches the main panel mediator to the main panel. the main panel mediator then attaches mediators for the form panel and list panel.

The problem:

when registering the mediators for the form panel and list panel in the main panel mediator, the view component reference (to list / form panel) from the main panel is null. the reference from the main panel mediator to the form panel is null, the same applies to the list panel. The reason why is because the panels for form and list hasn't yet been rendered, therefore are null.

is there a way to eagerly load the panels? or is there a better way of architecting it to attach listeners to invoke the registermediator to happen after the panels have been created?

sorry im quite new to flex so any feedback on anyone who has come across a similar issue like this would be appreciated greatly.

+4  A: 

You could try setting the ViewStack's creationPolicy to "all" to force the Main panel to be initialised at startup.

Alternatively you could try attaching the Form and List mediators in the Main panel's creationComplete event - at that point you know that the Form and List have been initiailised.

For more information about the creationPolicy property: http://livedocs.adobe.com/flex/3/html/layoutperformance_05.html

Sly_cardinal