PureMVC Architects Lounge

Announcements and General Discussion => Getting Started => Topic started by: reduxdj on April 13, 2008, 11:59:29



Title: AS3 - null viewComponent Mediator
Post by: reduxdj on April 13, 2008, 11:59:29
I was trying to use flash cs3 to create a new PureMVC implementation, and I'm having issues with a null viewComponent in my applicationMediator.

Here's a snapshot of my problem.  i'm going off of how my flex works with passing a reference to my app as "this", from my main MovieClass in flash cs3...

from my main class

   var app:ApplicationFacade = new ApplicationFacade();
   app.startup(this);


How come when I pass my instance of my app to my ApplicationFacade it is not null.  However, when i try to access it in my app mediator it is?


when I try to access app like below...

facade.registerMediator ( new InitialViewMediator("InitialViewMediator",app.initialView)   );


it's always null...  Are there some difference to view startups from cs3 to flex?

Thanks,
reduxdj


Title: Re: AS3 - null viewComponent Mediator
Post by: puremvc on April 17, 2008, 11:56:04
Try this instead:
:
var facade:ApplicationFacade = ApplicationFacade.getInstance();
facade.startup(this.stage);

Also, I'm not sure how your startup method looks, but it should pass the reference to the app in the body of a Notification, probably named STARTUP, that will trigger a StartupCommand, that will create and register proxies and mediators.

-=Cliff>