Based on the code you provided you only have to do
parentApplication.closing.mainBox.addChild(newCanvas).

After that you could do newCanvas.addChild(...)
Etc without doing the parentApplication stuff.

It's hard to tell what other problems you might be having without seeing
what errors are coming out.

Matt

-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Jeremy Rottman
Sent: Friday, April 28, 2006 10:18 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Adding a child to a vbox

I think the issue, is when I try to add a child to a previously
created child. Here is the test code that I have.


                  for ( var i:Number=0;i<result.length;i++){
                                    // CREATE CANVAS //
                                    var newCanvas:Canvas =
new Canvas();
     
newCanvas.percentWidth = 100;
                                          newCanvas.id =
"canvas" + i;
                                    var canvasId =
newCanvas.id;
     
parentApplication.closing.mainBox.addChild(newCanvas);
                                    var newLabel:Label = new
Label();
                                          newLabel.text =
canvasId;
     
parentApplication.closing.mainBox.canvasId.addChild(newLabel);
                                   

                       
                                    }





--- In flexcoders@yahoogroups.com, "Jeremy Rottman" <[EMAIL PROTECTED]>
wrote:
>
> I have to use parentApplication.... because I am trying to create this
> grid from another state. So I have to work on the parent level.
>
> I have never used getChildByName, would I use it like this.
>
>
parentApplication.closing.mainBox.getChildByName(newGird:string).addChil
d(newGridRow);
>
>
> --- In flexcoders@yahoogroups.com, "Matt Chotin" <mchotin@> wrote:
> >
> > For one thing I would only do the
> > parentApplication.closing.mainBox.addChild(newGrid) and then for
every
> > other addChild just use the local variable.
> >
> > newGrid.addChild(newGridRow);
> > newGridRow.addChild(newGridItem);
> >
> > It will make things easier to follow, plus I'm not sure
mainBox.newGrid
> > will work unless it has an explicit property called newGrid,
otherwise
> > you have to do getChildByName or something like that.
> >
> > Matt
> >
> > -----Original Message-----
> > From: flexcoders@yahoogroups.com
[mailto:[EMAIL PROTECTED] On
> > Behalf Of Jeremy Rottman
> > Sent: Wednesday, April 26, 2006 8:50 AM
> > To: flexcoders@yahoogroups.com
> > Subject: [flexcoders] Adding a child to a vbox
> >
> > I am still working on this. I need to dynamically create a grid with
a
> > single row, and two items. Then I need to create labels, and text
input
> > inside the grid.  However, I cant get to that point yet, I am still
> > unable to the complete grid w/ a test label in side the grid. I am
> > working with in F2B2.
> >
> > Here is my code.
> >
> >                      for ( var i:Number=0;i<result.length;i++){
> >                          // CREATE GRID //
> >                          var newGrid:Grid = new Grid();
> >                              newGrid.id = 'grid' + i;
> >                              newGrid.percentWidth = 90;
> >                            
> > parentApplication.closing.mainBox.addChild(newGrid);
> >                          // CREATE GRID ROW //
> >                          var newGridRow:GridRow = new GridRow();
> >                              newGridRow.id = 'gridRow' + i;
> >                            
> > parentApplication.closing.mainBox.newGrid.addChild(newGridRow);
> >
> >                          if (result[i].TRANSSIDE is 'buyer'){
> >                                  // CREATE GRID ITEM //
> >                              var newGridItem:GridItem = new
GridItem();
> >                                  newGridItem.id = 'listGridItem' +
i;
> >                                  newGridItem.width = 445;
> >                                
> >
parentApplication.closing.mainBox.newGrid.newGridRow.addChild(newGridIte
> > \
> > m);
> >                                  // CREATE CANVAS //
> >                              var newCanvas:Canvas = new Canvas();
> >                                  newCanvas.id = 'canvas' + i;
> >                                
> >
parentApplication.closing.mainBox.newGrid.newGridRow.newGridItem.addChil
> > \
> > d(newCanvas);
> >                                  // CREATE LABEL //
> >                              var newLabel:Label = new Label();
> >                                  newLabel.text = "TEST";
> >                                
> >
parentApplication.closing.mainBox.newGrid.newGridRow.newGridItem.newCanv
> > \
> > as.addChild(newLabel);
> >
> >                                  }
> >                          else if (result[i].TRANSSIDE is 'seller'){
> >                                  // CREATE GRID ITEM //
> >                              var newGridItem:GridItem = new
GridItem();
> >                                  newGridItem.id = 'saleGridItem' +
i;
> >                                  newGridItem.width = 529;
> >                                
> >
parentApplication.closing.mainBox.newGrid.newGridRow.addChild(newGridIte
> > \
> > m);
> >                                  // CREATE CANVAS //
> >                              var newCanvas:Canvas = new Canvas();
> >                                  newCanvas.id = 'canvas' + i;
> >                                
> >
parentApplication.closing.mainBox.newGrid.newGridRow.newGridItem.addChil
> > \
> > d(newCanvas);
> >                                  // CREATE LABEL //
> >                              var newLabel:Label = new Label();
> >                                  newLabel.text = "TEST";
> >                                
> >
parentApplication.closing.mainBox.newGrid.newGridRow.newGridItem.newCanv
> > \
> > as.addChild(newLabel);
> >
> >                                  }
> >
> >
> >
> >
> >
> >
> >
> > --
> > 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
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