PureMVC Architects Lounge

PureMVC Manifold => MultiCore Version => Topic started by: eco_bach on May 28, 2014, 07:28:48



Title: PrepView Command -stage is null
Post by: eco_bach on May 28, 2014, 07:28:48
Pulling my hair out on this one. I've used PureMVC for several years, primarily with AS3 projects.

On an AIR project I am trying to recompile, I keep getting a null stage error in my PrepViewCommand.

I cannot recall changing anything in the code, and it compiled fine the last time ( about 3 mo the ago).

Getting the following error
TypeError: Error #1009: Cannot access a property or method of a null object reference.
 PrepViewCommand.as:15]

Using Multicore PureMVC_AS3_MultiCore_1_0_5 and compiling using Flash CS6
Tried targeting AIR 3.4, 3.9 and 4.0. No difference.
Can anyone suggest some debugging steps to try?
I also notice that for some reason my StartupCommand is called twice, or at least instantiated twice



:
public class PrepViewCommand extends SimpleCommand {
override public function execute(note:INotification):void {
var app:Main=note.getBody().main as Main;


//line 15 var stage:Stage=MovieClip(app).stage;
/**
* Get the View Components for the Mediators from the app,
* which passed a reference to itself on the notification.
*/
facade.registerMediator(new StageMediator(stage, app));
facade.registerMediator(new ApplicationMediator(app));

}
}





Title: Re: PrepView Command -stage is null
Post by: puremvc on May 29, 2014, 08:42:26
"I also notice that for some reason my StartupCommand is called twice, or at least instantiated twice"

I'd start by figuring that part out. Something's seriously out of whack with your startup process.

I think whatever's triggering the PrepViewCommand when it shouldn't is not sending the app in the notification. That would mean that app is null and therefore the cast to MovieClip in line 15 would fail.