tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/1540-using-objectproxy-as-an-alternative-to-binding-in-systemmediator-and-voRobotlegs: Discussion 2018-10-18T16:35:45Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/230623562012-12-24T15:43:11Z2012-12-24T15:43:11ZUsing Objectproxy ( as an alternative to binding) in SystemMediator and Vo<div><p>Hi Vishwas,</p>
<p>I’m busy with travel preparations, so I don’t have
time to answer your question properly, but I’ve notified
Shaun about it.</p>
<p>Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/230623562012-12-27T16:19:19Z2012-12-27T16:19:19ZUsing Objectproxy ( as an alternative to binding) in SystemMediator and Vo<div><p>Hi Vishwas,</p>
<p>ObjectProxy provides one way to do "binding", but you could
still just do it the normal way:</p>
<pre>
<code>[Bindable]
Class VO
public var prop1:String;
public var prop2:String;</code>
</pre>
<p>Binding is not specific to Flex (it is just that MXML is the
most convenient way to <em>use</em> binding). Also, MXML isn't even
specific to Flex - you can use it lay out ActionScript views (but
that's a whole other discussion).</p>
<p>Binding is simply an event driven mechanism for updating values
(apologies if you know all of this already). The long-hand form of
the VO psuedocode above is as follows:</p>
<pre>
<code>Class VO extends EventDispatcher
[Bindable("prop1Change")]
public function get prop1():String
return _prop1;
public function set prop1(value:String):void
if (_prop1 != value)
_prop1 = value;
dispatchEvent(new Event("prop1Change"))</code>
</pre>
<p>With MXML you are then able to bind directly to such a
property:</p>
<pre>
<code><Label text="{vo.prop1}" /></code>
</pre>
<p>With plain ActionScript you'd need to use BindingUtil:</p>
<pre>
<code>BindingUtils.bindProperty(myLabel, 'text', vo, ['prop1']);</code>
</pre>
<p>Hope that helps, or provides some clues!</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/230623562012-12-27T16:27:38Z2012-12-27T16:27:38ZUsing Objectproxy ( as an alternative to binding) in SystemMediator and Vo<div><p>Thanks Shaun.<br>
I think, i too agree with you. Binding should not be specific to
flex.<br>
I did everything to make binding work in Flash... but failed.<br>
<a href=
"http://stackoverflow.com/questions/13904382/trying-to-use-bindingutils-in-flash-as3-0">
http://stackoverflow.com/questions/13904382/trying-to-use-bindingut...</a></p>
<p>I even tried "bindage-tools" ( which seems an extended form of
binding-tools )<br>
<a href=
"http://stackoverflow.com/questions/14009308/bindage-tools-doesnot-reflect-the-changed-input">
http://stackoverflow.com/questions/14009308/bindage-tools-doesnot-r...</a><br>
That too doesnot seem to work in Flash.</p>
<p>I also, checked ON the "swc" ( The similar bug that causes
"Robotlegs" metatags not to work in Flash). But that too didnot
work</p>
<p>Anyways.. i am going to look into your explanation. I am sure, i
will get some clues as always. Thanks for response and help.</p>
<p>Vishwas</p></div>vishwas.gagranitag:robotlegs.tenderapp.com,2009-10-18:Comment/230623562012-12-27T16:38:07Z2012-12-27T16:38:07ZUsing Objectproxy ( as an alternative to binding) in SystemMediator and Vo<div><p>Are you compiling with Flash Pro (the Flash IDE), or are you
using FlashBuilder/FDT/IntelliJ/FlashDevelop to compile plain
ActionScript projects? I doubt binding will work with the Flash Pro
compiler (which is, sadly, different from the compiler provided by
the Flex SDK, and not entirely compatible).</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/230623562012-12-27T17:02:14Z2012-12-27T17:02:14ZUsing Objectproxy ( as an alternative to binding) in SystemMediator and Vo<div><p>Regarding your first SO question, did you try the long-hand
binding form? The short-hand version requires the compiler to
rewrite the class definition.</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/230623562012-12-27T18:37:27Z2012-12-27T19:41:42ZUsing Objectproxy ( as an alternative to binding) in SystemMediator and Vo<div><p>amm... The code i am testing is so simple, that i don't see any
scope of using long-hand binding form.</p>
<pre>
<code> import mx.binding.utils.*;
[Bindable]
var myValue:int = 0;
var cw:ChangeWatcher = BindingUtils.bindSetter(myValueChanged, this, "myValue");
addEventListener( Event.ENTER_FRAME , ef);
function ef(e:Event):void
{
trace("hello",getTimer());
myValue = getTimer();
}
function myValueChanged(o:Object):void
{
trace("myValue: " + myValue.toString());
}</code>
</pre>
<p>I would be glad to know, if there is some long-handed version
for this code. And ultimately can make it work . :)</p>
<p>PS: And yes, it's Flash Pro compiler i am using.</p></div>vishwas.gagranitag:robotlegs.tenderapp.com,2009-10-18:Comment/230623562012-12-27T20:48:02Z2012-12-27T20:48:02ZUsing Objectproxy ( as an alternative to binding) in SystemMediator and Vo<div><p>I've added some examples on SO: <a href=
"http://stackoverflow.com/questions/13904382/trying-to-use-bindingutils-in-flash-as3-0/14060664#14060664">
http://stackoverflow.com/questions/13904382/trying-to-use-bindingut...</a></p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/230623562012-12-28T07:13:15Z2012-12-28T07:13:15ZUsing Objectproxy ( as an alternative to binding) in SystemMediator and Vo<div><p>That was wonderful. Thanks tonnes! :)</p></div>vishwas.gagrani