Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought

Welcome, Guest. Please login or register.
January 20, 2018, 10:17:47
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]
Author Topic: PrepView Command -stage is null  (Read 9607 times)
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.

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));


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.
Pages: [1]
Jump to: