Alex explained how this works, event though XML does not dispatch events. I'll post his explanation below. But bottom line, XML is bindable. Here is a simple example:
http://www.cflex.net/showFileDetails.cfm?ObjectID=628 Tracy ------------------------------------------------------------------------ ---------------------- XML does not dispatch events per-se. It is like Object. However, unlike Object, every XML node can be assigned a callback which converts it into a notifying XML node. That's what XMLNotifier does. All changes to a node hooked up by XMLNotifier, no matter how deep should result in a change event that binding should pick up. One common error is to assign your binding expressions in a way that does not tell the compiler that you are binding to XML. The classic is {myservice.lastResult.someData}. If the compiler doesn't think that is XML, it will try to attach regular PropertyChangeWatchers and you'll get those binding warnings in the debugger when it finds that it isn't a bindable object. If you use {XML(myservice.lastResult.someData)}, that makes sure the compiler sees it as XML and should use XML binding and wrap that node in an XMLNotifier, and those binding warnings will go away. It is entirely possible that you've found a way to change the XML in a way that the XMLNotifier notfications aren't on those nodes. We'd be interested in that kind of scenario. If you hand-rolled your own binding hookups, make sure you use the correct watchers. -Alex ------------------------------------------------------------------------ ------------------------------ ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Tracy Spratt Sent: Thursday, August 28, 2008 1:36 PM To: [email protected] Subject: RE: [flexcoders] Re: asigning text with script error XML is bindable. Tracy ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Amy Sent: Thursday, August 28, 2008 1:14 PM To: [email protected] Subject: [flexcoders] Re: asigning text with script error --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "Tracy Spratt" <[EMAIL PROTECTED]> wrote: > > " if i make a var bindable, i can give values to it later on a function? " Absolutely. For example, untested: > > [Bindable]private var _xmlRData:XML; //bindable instance var containing data > .... > private function rLoaded(event:Event) : void{ > _xmlRData = XML(event.target.data); //set the instance var value > } > ... > <!-- Bind the text property to the xml nodes value --> > <mx:Text id="txtBy" text="{_xmlRData.info.author.name.text()}" .../> > > Tracy I think that XML doesn't provide its own events for binding, so you'd probably need to do that yourself. So you might needs something more like: [Bindable (event="rDataChange")] private var _xmlRData:XML; private function rLoaded(event:Event):void{ _xmlRData=XML(event.target.data); dispatchEvent(new Event('rDataChange')); } I'd suspect you might also get errors before _xmlRData has info and its descendent tags, so maybe something like this might be more bulletproof: _xmlRData.child('info').child('author').child('name').text() HTH; Amy

