I'm using the Cairngorm framework, so in the implented Command classes...

For the XML problem, it's in a class that the Command class calls. The
constructor load the XML file stored locally, then the completeHandler
calls XML(event.target.data) and assigns the XML to a local variable.

However, when I instantiate this object, then call a method on it, the
XML is still null. If I put a timer on it to stall for a second, it's
there....

--- In flexcoders@yahoogroups.com, "Peter Farland" <[EMAIL PROTECTED]> wrote:
>
>
> Where are you declaring these classes?

>
> -----Original Message-----
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
On Behalf Of Suzy Lawson
> Sent: Friday, June 02, 2006 12:01 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Instantiation and setting problems
>
> I anyone else having issues trying to set values on objects for
newly instantiated objects in an object graph with 3 or more layers?
>
> I have the following:
>
> ClassA {
>  public var classB : ClassB;
>  public var classC : ClassC;
> }
>
> ClassB {
>  public var classD : ClassD;
> }
>
> ClassC {
>  public var textVal : String='';
> }
>
> and i have a value sets in the ModelLocator (cairngorm) class like so:
> public var allClassAs : ArrayCollection; public var selectedClassA :
ClassA;
>
> The problem is if I retrieve a single 'ClassA' from the collection
of allClassAs using the ID of the selectedClassA, then try to make a
call like this:
> classA.classC.text="Whatever";
>
> The mxml field I have bound to that value never displays and I get
the following debug error.
>
> error during evaluation
> no such variable: classA.classC.textVal
>
> This kind of makes sense since classC wasn't initialized yet, so
even if I change ClassA to be:
> ClassA {
>  public var classB : ClassB = new ClassB();  public var classC :
ClassC = new ClassC(); }
>
> I still get the same error. In the UI, if I click back, it appears
correctly, but the first time it always fails. It seems like the set
> (classA.classC.text="Whatever";) is getting called faster then the
object can be initialized (constructed).
>
> I've had similar problems when calling:
> var myXML = new XML(event.target.data);
> [EMAIL PROTECTED]"3232";
>
> When I debug this, myXML is still null when the 2nd line is called.
A work around is to instantiate the XML on startup so the XML is there
before calling the set on @ID, but means more memory.
>
> Anyone else hitting these issues? 
>
>
>
>
>
>
> ------------------------ Yahoo! Groups Sponsor
--------------------~--> Everything you need is one click away.  Make
Yahoo! your home page now.
> http://us.click.yahoo.com/AHchtC/4FxNAA/yQLSAA/nhFolB/TM
> --------------------------------------------------------------------~->
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com
> Yahoo! Groups Links
>







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




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to