tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/9346-starling-robotlegsRobotlegs: Discussion 2018-10-18T16:35:56Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/352549622014-11-12T14:05:27Z2014-11-12T14:05:27ZStarling + Robotlegs<div><p>Hi Valentin,</p>
<p>There is an example application using the framework that you
mentioned:<br>
<a href=
"https://github.com/joshtynjala/feathers-weather">https://github.com/joshtynjala/feathers-weather</a></p>
<p>It seems, that models are injected like this:</p>
<p><a href=
"https://github.com/joshtynjala/feathers-weather/blob/master/source/feathers/examples/weather/view/mediators/LocationViewMediator.as#L19">
https://github.com/joshtynjala/feathers-weather/blob/master/source/...</a></p>
<p>hth</p>
<p>Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/352549622014-11-12T14:39:24Z2014-11-12T14:39:24ZStarling + Robotlegs<div><p>yeah I saw this example and there is nothing to explain my
question.<br>
My question is how to inject each specific property of some model
into Mediator.<br>
Part of code for a Mediator:</p>
<p>[Inject(source="gameModel.fsModeStarted")] public function set
onFsModeStarted(value:Boolean):void<br>
{ trace("prop has been changed")<br>
}</p>
<p>I have a lot of properties in Model and mediator need to be
notified when each property of Model has been changed. One model
property - one handler function in Mediator, not for all properties
but most of them</p></div>smivaltag:robotlegs.tenderapp.com,2009-10-18:Comment/352549622014-11-12T16:39:24Z2014-11-12T16:39:24ZStarling + Robotlegs<div><p>That's an unusual use of Models. That's the first time I hear of
needing to inject each property of a Model into other classes while
using robotlegs.<br>
I guess, you're after the binding mechanism that StarlingMVC
offers. Swiftsuspenders' injection doesn't work like
StarlingMVC.<br>
I don't know if joshtynjala/robotlegs-framework-starling provides
features that facilitate such a usage. You might want to contact
Josh for further explanations or assistance with issues specific
for Starling or his framework.</p>
<p>With the original robotlegs, we usually inject a model like
so:</p>
<p>[Inject] public var someModel:SomeModel;</p>
<p>and access model's properties like so:</p>
<p>someModel.someProperty<br>
someModel.anotherProperty</p>
<p>Or, when we want a class to be notified when model's properties
change, we dispatch an event from within the model's setter for a
certain property (or other methods of your choice). Such a model is
injected with a shared event dispatcher, in order to be able to
dispatch events, in robotlegs 2 ( like the Actor class in Robotlegs
v. 1 )<br>
The event can carry a payload, if need be.<br>
Or, if you're using as3-signals, the model can dispatch a signal
when its properties change.</p>
<p>Mediators can listen for events from Models and do whatever they
need to do in the handlers for those events, where they can access
the event's payload ( the model's property that changed, for
example)</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/352549622014-11-20T13:50:00Z2014-11-20T13:50:00ZStarling + Robotlegs<div><p>thanks for explanation</p></div>smival