I had earlier posted a blogpost on Binding in MXML & AS. And I received a comment from Judah Frangipane asking if you can unbind a variable in Flex. So here it is…
The trick is to capture the ChangeWatcher Object that get returned when you use BindingUtils.bindProperty() method. The ChangeWatcher object then has an unwatch() method that can be used to break the watch. If you bind in mxml using the curly brackets unfortunately, this does not work. You might have to break the binding altogether and not be able to turn it on and off.
Sample Application | Source Code
Update: Also read this post by Alex Uhlmann
Thanks Eric for pointing to this


September 17, 2007 at 8:24 am |
Better yet, use the Observe tag and get type safety.
Something to read re this:
http://weblogs.macromedia.com/auhlmann/archives/2006/09/using_binding_s.cfm#more
Have a great day ya’ll <3
September 17, 2007 at 8:57 am |
@Erik – Thanks a lot man.. I learned something today
September 17, 2007 at 8:59 am |
Cool!!! Thanks Raghu!
September 17, 2007 at 5:21 pm |
I have another question. How would you write this in AS3? This mxml tag inside a canvas component inside a repeater.
September 17, 2007 at 5:22 pm |
doh! the comment submission ate my code. here it is again:
ns1:MyComponent width=”70%” height=”70%” source=”http://192.168.0.1/page{pageid}/sheet{fncCheckLeadingZeros(repeaterObject.id)}.htm” x=”65″ y=”76″/
September 22, 2007 at 10:17 pm |
figured it out using BindingUtils.bindSetter method. thanks!
September 24, 2008 at 7:34 pm |
Hello.
Is unbinding/unwatching necessary?
For instance, if I create an object, make some bindings to it and later remove the object. Will the bindings processes remove automatically or not?
thank you
October 7, 2008 at 10:21 am |
Maybe you can help me. In flex I don’t want to bind an object property to another one, I wolud like to bind to a specific variable (i.e. a value of a Resource bundle for a multilanguage application)…
How can I do this?