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: PrepView Command -stage is null  (Read 16589 times)
eco_bach
Courseware Beta
Sr. Member
***
Posts: 81


View Profile Email
« 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));

}
}



Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



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