Commandlist and Robotlegs

409 views Asked by At

Heyooo I want to incorporate a commandlist into robotlegs, the way i've done it now is to have a commandlist actor funnel out all the commands when not busy, but when the commands are executed robotlegs loses its' reference to the 'contextView'. Meaning i'm doing somehting wrong.

Has anyone any useful tips on CommandLists and Robotlegs? Because i assume it's been done countless times before.

3

There are 3 answers

0
darscan On

How are you executing these commands?

Perhaps you were instantiating and executing them manually?

You should be using the commandMap to instantiate and execute them - this will ensure that their dependencies (like contextView etc) are supplied. For example:

commandMap.execute(SomeCommandClass);

Or (if your commands rely on events):

commandMap.execute(SomeCommandClass, someEventInstance, SomeEventClass);

If you need access to the commandMap in your utility, you might need to inject it:

[Inject] public var commandMap:ICommandMap;

Hope that helps.

1
Michał Wróblewski On

You should be interested in that utility for RobotLegs.

CommandLib (SequenceCommand)

3
Amy Blankenship On

This sounds like you're trying to run a bunch of Commands one after another in response to a single event. My understanding is that you should either have each Command generate an Event that triggers the next Command or simply register all the Commands to the same Event.

You shouldn't ever be touching the value of contextView (to write), so it sounds like you're doing something you shouldn't.