Signals and Robotlegs

x0b's Avatar

x0b

08 Apr, 2010 12:40 PM

I'm having a bit of a problem with getting signals to work properly. I have the latest RL, signals and CommanMap Extension.

Relevant code in SignalContext:

signalCommandMap.mapSignalClass(XMLLoadedSignal, XMLLoadedSignalCommand);

Relevant code in XMLLoader :

var xmlLoaded : XMLLoadedSignal  = new XMLLoadedSignal();
xmlLoaded.dispatch();

XMLLoadedSignal:

public class XMLLoadedSignal extends Signal {
    public function XMLLoadedSignal() {
        trace("signal xml loaded");
    }
}

XMLLoadedSignalCommand :

public class XMLLoadedSignalCommand extends SignalCommand 
{
    override public function execute() : void
    {
        trace("command xml loaded");
    }
}

I get the first trace "signal xml loaded" but not the second trace("command xml loaded") - it seems the signal is not executing the command. Is there something fundamental I am missing here? Is there anything else I need to set up?

Thanks

  1. 1 Posted by x0b on 08 Apr, 2010 12:48 PM

    x0b's Avatar

    Never mind, that's twice I've found the answer as soon as I write out the question!

    I was not injecting the Signal into the XMLLoader class, I was creating a new instance of it which was not mapped.

    Here is the relevant code for anyone like me who is a bit dim :P

    public class XMLLoader extends Actor 
    {
        [Inject]
        public var xmlLoaded:XMLLoadedSignal;
    
        public function XMLLoader()
        {
            super();
        }
    
        public function loadingComplete() : void 
        {
            trace("start loading the xml in");
            xmlLoaded.dispatch();
        }
    }
    
  2. x0b closed this discussion on 21 Sep, 2010 11:37 AM.

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

Keyboard shortcuts

Generic

? 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