Started getting null object reference in

vishwas.gagrani's Avatar


07 Oct, 2012 08:59 PM

I have recently started getting null object reference on the line "if(eventDispatcher.hasEventListener(event.type))".

protected function dispatch(event:Event):Boolean

        if(eventDispatcher.hasEventListener(event.type)) //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            return eventDispatcher.dispatchEvent(event);
        return false;  

It's wierd, as all the previous project are running fine. However when i start creating a new "TEST" project, i get error on this line

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// swc/ :

    override public function startup():void

        commandMap.mapEvent(DatabaseEvent.CONFIGURE, ConfigureDatabaseCommand);
        commandMap.mapEvent(DatabaseEvent.READY, InitAppCommand); // <<<<< SEEMS LIKE THIS IS NOT WORKING, BUT WHY???
        dispatchEvent(new DatabaseEvent( DatabaseEvent.CONFIGURE));


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// swc/events/


public class DatabaseEvent extends Event
    public static const CONFIGURE:String = "Configure";
public static const READY:String = "Ready";
    private var _body:*;
    public function DatabaseEvent(type:String, body:* = null)
        _body = body;

    public function get body():*
        return _body;

    override public function clone():Event
        return new DatabaseEvent(type, body);


  1. Support Staff 1 Posted by Stray on 08 Oct, 2012 07:40 AM

    Stray's Avatar

    Any chance you're losing your metadata? That would prevent the command from having the eventDispatcher set via the injector - causing a null error for the eventDispatcher variable.

  2. 2 Posted by vishwas.gagrani on 08 Oct, 2012 04:35 PM

    vishwas.gagrani's Avatar

    ah! .. finally got it from the robotlegs knowledge base. I remember the same issue, when i started using robotlegs examples. I forgot it after so many months, that it's important checking the "create SWC" in the FLA.

    Thnx anyways. :)

  3. vishwas.gagrani closed this discussion on 08 Oct, 2012 04:35 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac