I am binding a checkbox to a property on a control. Everything is fine, but I need to bind the checkbox to another property, and the value needs to be the opposite of chkbox.checked.
BindingUtils.bindProperty(obj, "propertyBool", checkBox, "selected");
I need something like this...
BindingUtils.bindProperty(obj, "propertyBool", checkBox, "!selected");
but I'm not sure how to go about doing it in AS3.
You can use BindingUtils's bindSetter method. It works pretty much the same as the bindProperty method, but it fires a method which takes the value of the property you're binding to as an argument.
Something like the following:
BindingUtils.bindSetter(propertyBoolListener, checkBox, "selected");
private function propertyBoolListener(value:Boolean):void
{
obj.propertyBool = !value;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With