Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Welcome, Guest. Please login or register.
April 26, 2017, 08:08:00 PM
Home Help Search Login Register
News: ATTENTION: Spambots must die! Humans must visit http://contact.futurescale.com to request forum access.
Pages: [1]
Print
Author Topic: Why null ?  (Read 3120 times)
davidTikva
Jr. Member
**
Posts: 12


View Profile Email
« on: January 09, 2011, 11:01:52 AM »

Hello,
I moved from standard to multiCore, and of course, it's pretty much the same
and as for my problem, I don't think it's matter:

I'm creating a facade in this way:

public function MyFacade(key:String)
{
   super(key);
}

this is the getInstance function:
public static function getInstance(key:String) : MyFacade
{
      if(instanceMap[key] == null) instanceMap[key] = new MyFacade(key);
         
   return MyFacade(instanceMap[key]);
}

this is the initializeController function:
override protected function initializeController():void
{
         registerCommand( ShellConsts.STARTUP, StartupCommand );
}

I get on this function this error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
   at org.puremvc.as3.multicore.patterns.facade::Facade/registerCommand()

why is that?  Shocked

thanks in advanced
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2865



View Profile WWW
« Reply #1 on: January 12, 2011, 11:13:25 AM »

You need to call super.initializeController() first. Here's what's not happening when you fail to do that in MultiCore:

Code:
       protected function initializeController( ):void {
            if ( controller != null ) return;
            controller = Controller.getInstance( multitonKey );
        }
-=Cliff>
Logged
Pages: [1]
Print
Jump to: