I've got a XML object that is shared by some components. Is it possible to set a BindSetter to a specific tag and call a function if that property changes?
I've tried it, but the BindSetter call doesn't seem to accept XML tag names.
When simply using [Bindable] and using the the tag name in MXML (i.e. label text="{myXMLObject.tagName}") this works fine, so I figure this has to work in pure AS as well, I just haven't figured out how.
Any hints?
Based on the comments/answer, here is a very basic example of my code/usage.
Two components in a Flex app, both inherit the same XML object;
[Bindable] public var sharedData:XML;
Then in the creationComplete handler of every component, I call the BindSetter;
BindingUtils.bindSetter(sharedDataChange, sharedData, "tagName");
sharedDataChange doesn't do anything at this point, just tracing that the function has been called.
I've then got a Label that displays the value of sharedData.tagName, a textInput and a button that sets sharedData.tagName = textInput.text.
Using MXML binding ({label.text = sharedData.tagName}) this works fine.
But as I said, the BindSetter function doesn't seem to detect the changes.
bindSetterformyXMLObject.tagName? - Engineer