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




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