FlarManger and RobotLegs

Almog's Avatar


03 Sep, 2010 01:07 AM

Hi I'm having some issues working with RobotLegs and FlarManger. I'm trying to listen to an event from my mediator but I'm getting a number of errors.

I have a view called flarMangerView

` public function FlarMangerView()

        var flarManager:FLARManager = new FLARManager("Assets/XML/flarConfig.xml", new FLARToolkitManager(), this.stage);


and my Mediator

` override public function onRegister():void

         this.eventMap.mapListener(flarMangerView.flarManager, Event.INIT, onFlarManagerInited);


I'm getting an error from the event map function -
1178: Attempted access of inaccessible property flarManager through a reference with static type com.almogdesign.robotlegs.view:FlarMangerView. FlarMangerMediator.as /twTelecomArApp/src/com/almogdesign/robotlegs/view line 51 Flex Problem

  1. 1 Posted by Jason Dias on 03 Sep, 2010 02:06 AM

    Jason Dias's Avatar

    flarManager is being declared as a local variable in the constructor of FlarManagerView, if you want to access flarManager you should declare it as a public var.

    public var flarManager:FlarManager;
    public function FlarMangerView()
        flarManager = new FLARManager("Assets/XML/flarConfig.xml", new FLARToolkitManager(), this.stage);
  2. 2 Posted by Almog on 03 Sep, 2010 02:15 AM

    Almog's Avatar

    Hi Jason, thanks for getting back to me on this, I have tried which throws another error, TypeError: Error #1009: Cannot access a property or method of a null object reference.

    at org.robotlegs.base::EventMap/mapListener()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/robotlegs-framework/src/org/robotlegs/base/EventMap.as:118]

    I'm I missing something here?

  3. 3 Posted by Jason Dias on 03 Sep, 2010 02:31 AM

    Jason Dias's Avatar

    Yes, I am not familiar with Flar, but what I would do in this situation is listen to the entire view for events rather then directly to the flarManager, if the event bubbles the mediator will see it, if not you can create a customEvent to listen to in your view.

    eventMap.mapListener(flarMangerView, Event.INIT, onFlarManagerInited);

  4. 4 Posted by Almog on 03 Sep, 2010 02:49 AM

    Almog's Avatar

    Not sure I understand but what you mean listening to the entire view? Can you explain this further

    I was looking at doing all the events in the view but it adds a lot of overhead creating a number of events and dispatching events you also start coupling everything together losing the point of using RobotLegs.

    You end up creating 4 to 5 events in your view , each one dispatching a custom event to your mediator which then dispatches another 4 to 5 events to framework either directly or via commands.

    The other option I got to was having the view dispatch the events directly to a command but that leaves the mediator out and again breaks up the structure of RobteLegs

    Maybe RobotLegs can't work with certain frameworks?

  5. 5 Posted by Jason Dias on 03 Sep, 2010 06:05 AM

    Jason Dias's Avatar

    Yea, you can't really get around creating custom events or signals for the framework.

    I don't really know what you are trying to accomplish and I am not all that familiar with Flar, but I will show you a quick example of how I would approach this.


  6. 6 Posted by Almog on 03 Sep, 2010 06:20 AM

    Almog's Avatar

    Hi Jason this is really great, thanks I appreciate it, from here I would have a command or model listen to the event that's dispatched from the Mediator?

    Just finished reading up on a number of things can you tell me if this is the correct workflow.

    View send event to Mediator which sends event to a command which then sends the event to the model. Best practices would be to create one custom event for the hole process?

    Would you recommend using Signals, it seems the same as using custom events what befits are there?

    Going to implement this method, thanks for all the help.

  7. 7 Posted by Jason Dias on 03 Sep, 2010 06:47 AM

    Jason Dias's Avatar

    Yes, depending on what you want to do you would have a command mapped to that event.

    Yes, I generally group my events to handle the complete process, eg
    UserEvent.ADD, UserEvent.ADDED, UserEvent.REMOVE, UserEvent.REMOVED

    Signals are great too, really comes down to what you are comfortable with, I have been using signals for view - > mediator and custom events for the framework, however you are fine just using custom events until you get comfortable with Robotlegs.

  8. Almog closed this discussion on 06 Sep, 2010 04:44 AM.

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