And I thought I am done learing as3 !! Please tell me what am i doing wrong.-- lago.asâ
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â
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?