PureMVC Architects Lounge

Announcements and General Discussion => Getting Started => Topic started by: vladakg85 on July 09, 2009, 07:50:00



Title: StartupCommand can't see view component
Post by: vladakg85 on July 09, 2009, 07:50:00
Sometime happens that I try to register new component (mxml) with mediator in PrepViewCommand, and when I type app. there is no my component, what could be reason for this?

cmpPizzaOrderWindow is the problem...

:
public class PrepViewCommand extends SimpleCommand implements ICommand
{
override public function execute(notification:INotification):void
{
var app:DemoComboWithPureMVC = notification.getBody() as DemoComboWithPureMVC;
facade.registerMediator(new PizzaOrderWindowMediator(app.cmpPizzaOrderWindow));
}

}

:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
xmlns:components="view.components.*">
<mx:Script>
<![CDATA[
private static const NAME:String="DemoComboWithPureMVC";

private var facade:ApplicationFacade=ApplicationFacade.getInstance(NAME);

private function init():void
{
facade.startup(this);
}
]]>
</mx:Script>
<components:PizzaOrderWindow id="cmpPizzaOrderWindow"
x="250.5"
y="10"/>
</mx:WindowedApplication>


Title: Re: StartupCommand can't see view component
Post by: Jason MacDonald on July 09, 2009, 08:22:50
Where are you calling init() from? You should be calling it on the ApplicationComplete event so that you can ensure Flex has finished it's creation sequence. My guess is you are sometimes beating out Flex and starting the PMVC apperatus too early.


Title: Re: StartupCommand can't see view component
Post by: vladakg85 on July 09, 2009, 11:21:19
Where are you calling init() from? You should be calling it on the ApplicationComplete event so that you can ensure Flex has finished it's creation sequence. My guess is you are sometimes beating out Flex and starting the PMVC apperatus too early.
Thanks man, init() was my problem :)