Hi guys,
I just ran into a strange binding problem. In the mini app below, the Flex Label component is updated when 'someText' changes, but my boundSetter won't be called after the first, initial call.
In short: Why is the boundSetterForSomeText() function not called, while the label does update?
Could anybody please shed some light onto this fundamental issue? Thanks a million!
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" minWidth="1024" minHeight="768"
initialize="onInitialize()"
>
<mx:Panel>
<mx:Label text="{this.someText}" />
<mx:Button label="Set random text" click="generateRandom()" />
</mx:Panel>
<mx:Script>
<![CDATA[
import mx.binding.utils.ChangeWatcher;
import mx.binding.utils.BindingUtils;
[Bindable(event="xxx")]
public var someText : String;
public function onInitialize() : void
{
var cw:ChangeWatcher = BindingUtils.bindSetter(boundSetterForSomeText, this, ['someText']);
}
public function generateRandom() : void
{
this.someText = String( Math.round(Math.random() * 10000) );
this.dispatchEvent(new Event("xxx"));
}
public function boundSetterForSomeText(obj:Object) : void
{
trace( obj );
}
]]>
</mx:Script>
</mx:Application>