Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Welcome, Guest. Please login or register.
August 19, 2017, 07:47:35 AM
Home Help Search Login Register
News: Please DM @puremvc on Twitter to gain forum access. Spambots are why we can't have nice things.
Pages: [1]
Print
Author Topic: PrepView Command -stage is null  (Read 8604 times)
eco_bach
Courseware Beta
Sr. Member
***
Posts: 81


View Profile
« on: May 28, 2014, 07:28:48 AM »

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



Code:
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: 2870



View Profile WWW
« Reply #1 on: May 29, 2014, 08:42:26 AM »

"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
Jump to: