tag:robotlegs.tenderapp.com,2009-10-18:/discussions/problems/162-flarmanger-and-robotlegsRobotlegs: Discussion 2018-10-18T16:35:16Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/27985072010-09-03T02:06:59Z2010-09-03T02:09:02ZFlarManger and RobotLegs <div><p>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.</p>
<pre><code>public var flarManager:FlarManager;
public function FlarMangerView()
{
flarManager = new FLARManager("Assets/XML/flarConfig.xml", new FLARToolkitManager(), this.stage);
this.addChild(Sprite(flarManager.flarSource));
}</code></pre></div>Jason Diastag:robotlegs.tenderapp.com,2009-10-18:Comment/27985072010-09-03T02:15:13Z2010-09-03T02:15:13ZFlarManger and RobotLegs <div><p>Hi Jason, thanks for getting back to me on this, I have tried which throws another error, TypeError: Error <a href="/discussions/problems/1009" title="Discussion #1009">#1009</a>: Cannot access a property or method of a null object reference.<br />
</p>
<pre><code>at org.robotlegs.base::EventMap/mapListener()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/robotlegs-framework/src/org/robotlegs/base/EventMap.as:118]</code></pre>
<p>I'm I missing something here?</p></div>Almogtag:robotlegs.tenderapp.com,2009-10-18:Comment/27985072010-09-03T02:31:12Z2010-09-03T02:31:12ZFlarManger and RobotLegs <div><p>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.</p>
<p><code>eventMap.mapListener(flarMangerView, Event.INIT, onFlarManagerInited);</code></p></div>Jason Diastag:robotlegs.tenderapp.com,2009-10-18:Comment/27985072010-09-03T02:49:04Z2010-09-03T02:49:04ZFlarManger and RobotLegs <div><p>Not sure I understand but what you mean listening to the entire view? Can you explain this further</p>
<p>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.</p>
<p>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.</p>
<p>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<br />
</p>
<p>Maybe RobotLegs can't work with certain frameworks?</p></div>Almogtag:robotlegs.tenderapp.com,2009-10-18:Comment/27985072010-09-03T06:05:51Z2010-09-03T06:05:51ZFlarManger and RobotLegs <div><p>Yea, you can't really get around creating custom events or signals for the framework.</p>
<p>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.</p>
<p><a href="http://gist.github.com/563484">http://gist.github.com/563484</a><br />
</p></div>Jason Diastag:robotlegs.tenderapp.com,2009-10-18:Comment/27985072010-09-03T06:20:18Z2010-09-03T06:20:18ZFlarManger and RobotLegs <div><p>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?</p>
<p>Just finished reading up on a number of things can you tell me if this is the correct workflow.</p>
<p>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? <br />
</p>
<p>Would you recommend using Signals, it seems the same as using custom events what befits are there?</p>
<p>Going to implement this method, thanks for all the help. <br />
</p></div>Almogtag:robotlegs.tenderapp.com,2009-10-18:Comment/27985072010-09-03T06:47:44Z2010-09-03T06:47:44ZFlarManger and RobotLegs <div><p>Yes, depending on what you want to do you would have a command mapped to that event.</p>
<p>Yes, I generally group my events to handle the complete process, eg<br />
<code>UserEvent.ADD, UserEvent.ADDED, UserEvent.REMOVE, UserEvent.REMOVED</code></p>
<p>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.</p></div>Jason Dias