tag:robotlegs.tenderapp.com,2009-10-18:/discussions/robotlegs-2/8013-pure-as3-very-simple-example-of-signals-in-robotlegs-flowRobotlegs: Discussion 2013-12-23T09:24:06Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/299250482013-11-12T09:48:29Z2013-11-12T09:48:29ZPure AS3 very simple example of signals in robotlegs flow <div><p>You need <strong>as3-signals</strong>:<br>
<a href=
"https://github.com/robertpenner/as3-signals">https://github.com/robertpenner/as3-signals</a><br>
The <strong>SignalCommandMap</strong> extension :<br>
<a href=
"https://github.com/robotlegs/robotlegs-extensions-SignalCommandMap">
https://github.com/robotlegs/robotlegs-extensions-SignalCommandMap</a><br>
and of course <strong>rl2</strong>.</p>
<p>Here a list of rl2 examples:<br>
<a href=
"http://knowledge.robotlegs.org/discussions/examples/20-links-to-robotlegs-v2-articles-examples-demos-utilities-and-tutorials">
http://knowledge.robotlegs.org/discussions/examples/20-links-to-rob...</a></p>
<p>Pure as3:<br>
<a href=
"https://github.com/probertson/robotlegs-examples-Simple_NoFlex">https://github.com/probertson/robotlegs-examples-Simple_NoFlex</a></p>
<p>Signals + SignalCommandMap:<br>
<a href=
"https://github.com/robotlegs/robotlegs-demo-TodoList">https://github.com/robotlegs/robotlegs-demo-TodoList</a></p>
<p>You could easily change it to a pure as3 project.</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/299250482013-11-12T10:38:53Z2013-11-12T10:38:53ZPure AS3 very simple example of signals in robotlegs flow <div><p>Now I know what I need to use signals in RL2. But still there is
no example with RL2 in pure AS3 with signals. Your last two links
are either with events instead of signals or with Flex. The first
link contains lots of links. Actually I saw that thread before
opening this one. But could not find the example I want. Anyway,
thank you. By looking through lots of threads I could manage to
build and example. Soon I will share it here too for newcomers in
the future to be easy.</p></div>naghekyantag:robotlegs.tenderapp.com,2009-10-18:Comment/299250482013-11-12T11:08:12Z2013-11-12T11:08:12ZPure AS3 very simple example of signals in robotlegs flow <div><p>Well, we are aware of the fact that there are too few demos,
examples and/or tutorials for robotlegs 2, but, each of us is
busy-busy making money... ;)<br>
So, all we can do is hope that the community will help compensate
the lack of documentation and demos.</p>
<blockquote>
<p>By looking through lots of threads I could manage to build and
example.</p>
</blockquote>
<p>Yes, that's a good way to learn.</p>
<blockquote>
<p>Soon I will share it here too for newcomers in the future to be
easy.</p>
</blockquote>
<p>Please do so!! We will welcome your contribution :)</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/299250482013-11-13T17:42:18Z2013-11-13T17:45:55ZPure AS3 very simple example of signals in robotlegs flow <div><p>Here is my example of using signals in RL2 with pure AS3. Sorry
for bad code but it represents the idea:</p>
<p>First you should include the SignalCommandMapExtension extension
as follows:</p>
<p>_context = new Context()<br>
.install(MVCSBundle, SignalCommandMapExtension)
.configure(MyAppConfig) .configure(new ContextView(this));</p>
<p>In MyAppConfig file you write this:</p>
<p>...... [Inject] public var
signalCommandMap:ISignalCommandMap;</p>
<p>and this:<br>
public function configure():void<br>
{ injector.map(XMLLoadedSignal).asSingleton();
signalCommandMap.map( XMLLoadedSignal ).toCommand(
XMLLoadedSignalCommand ); ...................</p>
<p>Define XMLLoadedSignal class as follows:</p>
<p>import org.osflash.signals.Signal;</p>
<p>public class XMLLoadedSignal extends Signal {<br>
public function XMLLoadedSignal() { trace("signal xml loaded"); }
}</p>
<p>Define XMLLoadedSignalCommand class as follows:</p>
<p>import robotlegs.bender.bundles.mvcs.Command;</p>
<p>public class XMLLoadedSignalCommand extends Command<br>
{</p>
<pre>
<code>override public function execute() : void
{
trace("Works!");
}</code>
</pre>
<p>}</p>
<p>In some mediator write this (this is the signal dispatching
part):</p>
<pre>
<code>[Inject]
public var xmlLoaded:XMLLoadedSignal;
public function dispatchMySignal():void {
xmlLoaded.dispatch();
}</code>
</pre>
<p>P.S. If you want to dispatch the signal from a View then you
should write the same thing what you wrote in the Mediator, but in
order to inject the signal in the View you should also write the
following in MyAppConfig's configure function:</p>
<p>viewProcessorMap.map(InGameView).toInjection();</p>
<p>That's it! :)</p></div>naghekyan