# Classes:I am doing it wrong \[pls direct the right way\]

**URL:** <https://forum.kirupa.com/t/classes-i-am-doing-it-wrong-pls-direct-the-right-way/309868>\
**Category:** Uncategorized\
**Created:** [May 26, 2010, 2:14pm UTC](https://forum.kirupa.com/t/classes-i-am-doing-it-wrong-pls-direct-the-right-way/309868 "2010-05-26T14:14:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![adBuryD](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@adBuryD](https://forum.kirupa.com/u/adBuryD)\
**Post date:** [May 26, 2010, 2:14pm UTC](https://forum.kirupa.com/t/classes-i-am-doing-it-wrong-pls-direct-the-right-way/309868/1 "2010-05-26T14:14:27Z")

</div>

And I thought I am done learing as3 😑 !! Please tell me what am i doing wrong.-- lago.as–

```auto
package {
    import flash.display.*;
    import flash.events.*;
    import board;
    public class lago extends MovieClip
    {
        public function lago() 
        {
            var dBoard:board =new board(3, 3)
            addChild(dBoard)
        }
    }
}

```

–board.as–

```auto
package {
    import flash.display.*;

    class board extends MovieClip {

        public function board(rows, cols) {

            var rows:uint;
            var cols:uint;

            var pSq:MovieClip = new MovieClip();
            var sq:Shape = new Shape();

            sq.graphics.beginFill( 0xff9933 , 1 );
            sq.graphics.drawRect( 0 , 0 , 20 ,20 );

            pSq.addChild(sq);
           
            for (var i:uint=0; i<rows; i++) 
            {
                for (var j:uint=0; j<cols; j++) 
                {
                    pSq.x=i*(j+20);
                    pSq.y=j*(i+20);
                    addChild(pSq)
                }
            }
        }
    }
}

```

in the fla use lago as “document class”.

My output is just one orange square while i was hoping for 9.😑  
How should i be doing this properly?
