There are several things that may be confusing you...
 
1. A child descriptor is not an actual child. The descriptor simply
stores the information specified for the MXML tag; it is used to create
an actual child DisplayObject. So a component can have a descriptor for
a child without yet having that child.
 
2. Components do not (or at least should not) create their children at
constructor time. In other words, after executing
 
    var f:Object = new form1();
 
the child DisplayObjects do not exist. They are created later, when you
put f onto the display list by doing someParent.addChild(f).
 
3. Due to the Flex feature known as "deferred instantiation", all
descendants do not necessarily get created when a component is put onto
the display list. For example, an Accordion creates grandchildren only
for its initially visible pane. The grandchildren on other panes get
created as you navigate to those panes. You should structure your code
to pull data into children as they get created.
 
I also recommend using strong typing:
 
    var f:form1 = new form1();
 
Gordon Smith
Adobe Flex SDK Team

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of riaengineer
Sent: Wednesday, December 05, 2007 8:11 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: getChildByName returning NULL SOLVED - kinda



Using callLater() seems to have fixed this behavior.

I dynamically created var f:Object = new form1();

I then call a recusive function on f, f.GetData()

o is found a 1-2 levels of recursion (a canvas that's in an accordion
that' in the canvs, f)

So perhaps the call to updateDisplayList,etc had't yet worked their
magic and created all of the nested components (namely o's childern).
The debugger, however had.

Calling callLater() before the recursive call, f.GetData() seems to
have fixed this problem.

Interesting.

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "riaengineer" <[EMAIL PROTECTED]> wrote:
>
> o.getChildByName("foo") returns NULL.
> However, I *can* drill down to the childDescriptors of o in the debug
> window. I do see "foo" therein.
> 
> 
> The call to o.getChildByName() was working until o's parent became a
> AS3 variable. Prior to this, o's parent was an MXML tag & everything
> worked. 
> 
> Any thoughts???
>



 

Reply via email to