5 Replies Latest reply on Apr 18, 2010 7:07 PM by JaxNa

    creat a grid

    JaxNa

      I want to creat grid

      5 column and 3 rows.

       

      How i can creat this? can u plz give me some example?

       

      Thanks

      Jaxna

        • 2. Re: creat a grid
          JaxNa Level 1

          i want to creat grid like that..grid copy.jpg

          • 3. Re: creat a grid
            Nishu Kshatriya

            Hi,

             

            pls try this.

             

            Drag the DataGrid component from the Components panel to the current document's library.

            and enter the following code.

             

            this.createClassObject(mx.controls.DataGrid, "my_dg", 10, {columnNames:["column1", "column2","column3","column4","column5"]});
            my_dg.setSize(500, 100);
            my_dg.move(10, 40);

            var myDP_array:Array = new Array();
            myDP_array.push({column1:"Row1", column2:"Row1",column3:"Row1",column4:"Row1",column5:"Row1"});
            myDP_array.push({column1:"Row2", column2:"Row2",column3:"Row2",column4:"Row2",column5:"Row2"});
            myDP_array.push({column1:"Row3", column2:"Row3",column3:"Row3",column4:"Row3",column5:"Row3"});
            my_dg.dataProvider = myDP_array;

             

            Hope it will helpful.

            • 4. Re: creat a grid
              Harry Kunz Level 4

              var _nW:Number = 70;

              var _nH:Number = 50;

              var _nX:Number = 20;

              var _nY:Number = 10;

              var _nRows:Number = 3;

              var _nColumns:Number = 5;

               

              for(var nRow:Number = 0; nRow < _nRows; nRow++)

              {

                 for(var nColumn:Number = 0; nColumn < _nColumns; nColumn++)

                 {

                    createSquare(_nX, _nY);

                    _nX += (10 + _nW);

                 }

                 _nY += (_nH + 10);

                 _nX = 20;

              }

              function createSquare(nX:Number, nY:Number):MovieClip

              {

                 var nDepth:Number = this.getNextHighestDepth();

                 var mc:MovieClip = this.createEmptyMovieClip("mc" + nDepth, nDepth);

                 mc.moveTo(nX, nY);

                 mc.beginFill(0xFF0000);

                 mc.lineTo(nX + _nW, nY);

                 mc.lineTo(nX + _nW, nY + _nH);

                 mc.lineTo(nX, nY + _nH);

                 mc.endFill();

                 return mc;

              }

              • 5. Re: creat a grid
                JaxNa Level 1

                thanks guys..