i am just learning actionscript 3.
goal: i want to create and display multiple rectangles inside of a group and at runtime access and change the rect properties like background color etc when the users' mouse clicks on a specific rectangle.
below is my first attempt to create a rectangle. but then I couldn't access it after I added it to the group.
var rect1:Shape = new Shape();
var group:Sprite = new Sprite();
rect1.graphics.lineStyle(1
);
rect1.graphics.beginFill(0
x0000FF,1)
;
rect1.graphics.drawRect(10
0,30,75,50
);
rect1.rotation = 45;
addChild(rect1);
group.addChild(rect1);
then I saw this method
var rect2:Rectangle = new Rectangle();
but that seems to just create something in memory and not display. but it seems this constructor is good for me becuase it gives me methods like containPoints()
thanks.
Start Free Trial