I do the similar stuff using “getChildAt(i)” instead of “childDescriptors[i]” and that works fine if I want to read the properties I set during createChild. Eg parentID.getChildAt(i).id

 

Thanks,

 

Shahn


From: [email protected] [mailto:[email protected]] On Behalf Of chip1062
Sent: Thursday, September 15, 2005 11:29 AM
To: [email protected]
Subject: [flexcoders] Dynamic Object Instantiation

 

Hello All,

I am dynamically instantiating a new VBox in a tab container
(tbFlyingHours). No problem with that.  It exists and can be
interacted
with.  The problem comes when I read the children of the tab
container.
If I use tbFlyingHours.childDescriptors.length the new VBox doesn't
show up, but if I use tbFlyingHours.numChildren the VBox is counted.
Also, I cannot access any of the properties of the VBox even though I
am setting them when the object is instantiated.  Any help would be
greatly appreciated.

Sincerely,

Chip

Code for Object Instantation:
import mx.containers.VBox;
function addReport(){
        var cReports:VBox = null;
        var init:Object = null;

        init = new Object();
        init.id="cnvReports";
        init.label="Report Output";

        cReports=VBox(tbFlyingHours.createChild(VB
ox,"cnvReports",init));

}

Code to see Objects in tbFlyingHours:
function showObjects(){
  for (var i:Number = 0 ; i < tbFlyingHours.numChildren ;  i++){
    mx.controls.Alert.show(tbFlyingHours.childDescriptors[i].id);
  }






--
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




Reply via email to