" 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


-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of David 
Pariente
Sent: Thursday, August 28, 2008 12:00 PM
To: [email protected]
Subject: Re: [flexcoders] asigning text with script error

mmm,

that could explain why the 1st time i exec it on fireworks it works 
while the second it doesn't (it might cache some content)...

but i will read an XML depending on values given...so i don't know how 
to do it without AS...
i did directly on the components at first, but then it allways 
complained that data still not came when component drawn.

about bindable...i don't really know what it does/how to use it...

if i make a var bindable, i can give values to it later on a function?

thnx


Tracy Spratt escribió:
>
> Further, look for a timing issue. Your components, like "rdata_by" 
> might not be instantiated when you attempt to set its properties. One 
> good solution to this problem is to bind to the data, instead of 
> directly assigning the value in AS.
>
> Often/usually/always?, a components properties are set before its 
> children are rendered.
>
> Tracy
>
> ------------------------------------------------------------------------
>
> *From:* [email protected] [mailto:[EMAIL PROTECTED] 
> *On Behalf Of *Tracy Spratt
> *Sent:* Thursday, August 28, 2008 11:56 AM
> *To:* [email protected]
> *Subject:* RE: [flexcoders] asigning text with script error
>
> Which is line 75? Debug to find out which reference is null.
>
> Also, probably not related to your problem, do not use "new" with 
> XML() . XML is not really a constructor but a top-level function. So 
> just do:
>
> var rXML:XML = XML(event.target.data);
>
> or
>
> var rXML:XML = event.target.data as XML;
>
> The second is a cast, and there are subtle differences in behavior 
> when the object is null.
>
> Tracy
>
> ------------------------------------------------------------------------
>
> *From:* [email protected] [mailto:[EMAIL PROTECTED] 
> *On Behalf Of *David Pariente
> *Sent:* Thursday, August 28, 2008 7:02 AM
> *To:* [email protected]
> *Subject:* [flexcoders] asigning text with script error
>
> Hi all,
>
> I got an strange error...
>
> I make some text change through AS3 on my app.
> When i test on IE, i see no change at all.
> When i test on FireFox, i see the changes. But if i reload the page i
> get this error on the browser:
>
> TypeError: Error #1009: Cannot access a property or method of a null
> object reference.
> at
> thethaichef/rLoaded()[K:\PROJECTS\Personal\thethaichef\src\thethaichef.mxml:75]
> at flash.events::EventDispatcher/dispatchEventFunction()
> at flash.events::EventDispatcher/dispatchEvent()
> at flash.net::URLLoader/onComplete()
>
> seems it finds an error on the rLoaded function (that starts when an XML
> is loaded), when i asign some text to the MXML:
>
> private function rLoaded(event:Event) : void{
> var rXML:XML = new XML();
> rXML = XML(event.target.data);
>
> currentState="recipe";
>
> rdata_title.title=rXML.info.thainame;
>
> rdata_by.text='by '+rXML.info.author.name;
>
>
> }
>
> does anyone knows what i'm doing wrong?
> thnx a lot!
>
>  



------------------------------------

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! 
Groups Links





Reply via email to