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

 

Reply via email to