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.m
xml: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!

 

Reply via email to