Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: StartupCommand can't see view component  (Read 6617 times)
vladakg85
Full Member
***
Posts: 22


View Profile Email
« 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>
Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile Email
« Reply #1 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.
Logged
vladakg85
Full Member
***
Posts: 22


View Profile Email
« Reply #2 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 :)
Logged
Pages: [1]
Print