I am working with some test code to create a two item grid row using add
child. I can create a single item grid row, and have it output my test
but it does work when I try to add two items.

I return from my cfc, an array that holds all the information to
populate this. Depending on how many I return, I need to create a new
grid for each set. 0,1:2,3:4,5...

First off this is how it should look if I were to hardcode it. And I had
0,1 returned.

             <mx:Grid id="displayGrid1" width="90%">
                 <mx:GridRow>
                     <-- SELLING SIDE ITEM -->
                     <mx:GridItem>
                         <mx:Canvas width="100%">
                             <mx:Label x="10" y="10" text="Label"
id="listAgentId1" fontWeight="bold"/>
                             <mx:Label x="30" y="36" text="Gross Agent
Commission:"/>
                             <mx:Label x="50" y="62" text="Transaction
Fee:"/>
                             <mx:Label x="53" y="88" text="E&amp;O
Fee:"/>
                             <mx:Label x="53" y="114" text="Addtional
Transaction Fee:"/>
                             <mx:Label x="30" y="140" text="Total
HomeSmart Fees:" fontWeight="bold"/>
                             <mx:Label x="53" y="166" text="Agent Current
Balance:"/>
                             <mx:Label x="30" y="192" text="Net
Commission:" fontWeight="bold"/>
                             <mx:TextInput x="275" y="34"/>
                             <mx:TextInput x="275" y="60"/>
                             <mx:TextInput x="275" y="86"/>
                             <mx:TextInput x="275" y="112"/>
                             <mx:TextInput x="275" y="138"/>
                             <mx:TextInput x="275" y="164"/>
                             <mx:TextInput x="275" y="190"/>
                         </mx:Canvas>
                     </mx:GridItem>
                     <!-- BUYING SIDE ITEM -->
                     <mx:GridItem width="529">
                         <mx:Canvas width="100%" height="100%">
                             <mx:Label x="10" y="10" text="Label"
id="saleAgentId1" fontWeight="bold"/>
                             <mx:Label x="30" y="36" text="Gross Agent
Commission:"/>
                             <mx:Label x="50" y="62" text="Transaction
Fee:"/>
                             <mx:Label x="53" y="88" text="E&amp;O
Fee:"/>
                             <mx:Label x="53" y="114" text="Addtional
Transaction Fee:"/>
                             <mx:Label x="30" y="140" text="Total
HomeSmart Fees:" fontWeight="bold"/>
                             <mx:Label x="53" y="166" text="Agent Current
Balance:"/>
                             <mx:Label x="30" y="192" text="Net
Commission:" fontWeight="bold"/>
                             <mx:TextInput x="275" y="34"/>
                             <mx:TextInput x="275" y="60"/>
                             <mx:TextInput x="275" y="86"/>
                             <mx:TextInput x="275" y="112"/>
                             <mx:TextInput x="275" y="138"/>
                             <mx:TextInput x="275" y="164"/>
                             <mx:TextInput x="275" y="190"/>
                         </mx:Canvas>
                     </mx:GridItem>
                 </mx:GridRow>
             </mx:Grid>


This is the test code that I am trying to use to create a two item grid
row.  This does not work, it will not display the text component
created.
                for (var i:Number=0;i<result.length;i++){

             // COMPONENTS
                 var myGrid:Grid = new Grid();
                 var myGridRow: GridRow = new GridRow();
                 var myGridItem: GridItem = new GridItem();
                 var myCanvas: Canvas = new Canvas();
                 var testText: Text = new Text();


             // GRID SETTINGS
                 myGrid.id = "grid" + i;
                 myGrid.percentWidth = 100;

             // GRID ROW SETTINGS
                 myGridRow.id = "gridRow" + i;

             // GRID LIST ITEM SETTINGS
                 myGridItem.id = "gridItem" + i;
                 myGridItem.width = 445;

             //  CANVAS SETTINGS
                 myCanvas.id = "canvas" + i;
                 myCanvas.percentWidth = 100;

             // TEST
                 testText.text = "This is a test" + i;




             // ADDING CHILDRENS
                 mainBox.addChild(myGrid);
                 myGrid.addChild(myGridRow);
                 myGridRow.addChild(myGridItem);
                 myGridItem.addChild(myCanvas);
                 myCanvas.addChild(testText);
                 myGridRow.addChild(myGridItem);
                 myGridItem.addChild(myCanvas);
                 myCanvas.addChild(testText);
}



When I do something like this. It does work, but it only creates one
row. And outputs all the text componets in that row.
                for (var i:Number=0;i<result.length;i++){

             // COMPONENTS
                 var myGrid:Grid = new Grid();
                 var myGridRow: GridRow = new GridRow();
                 var myGridItem: GridItem = new GridItem();
                 var myCanvas: Canvas = new Canvas();
                 var testText: Text = new Text();


             // GRID SETTINGS
                 myGrid.id = "grid" + i;
                 myGrid.percentWidth = 100;

             // GRID ROW SETTINGS
                 myGridRow.id = "gridRow" + i;

             // GRID LIST ITEM SETTINGS
                 myGridItem.id = "gridItem" + i;
                 myGridItem.width = 445;

             //  CANVAS SETTINGS
                 myCanvas.id = "canvas" + i;
                 myCanvas.percentWidth = 100;

             // TEST
                 testText.text = "This is a test" + i;




             // ADDING CHILDRENS
                 mainBox.addChild(myGrid);
                 myGrid.addChild(myGridRow);
                 myGridRow.addChild(myGridItem);
                 myGridItem.addChild(myCanvas);
                 myCanvas.addChild(testText);
}







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