trouble adding a rectange in actionscript
- by touB
I have a rectange that I've created and set its individual properties like so
var aRect:Rect = new Rect();
aRect.x = 10;
aRect.y = 10;
aRect.width = "15%";
aRect.height = "15%";
addChild(aRect);
I have 2 problems that the compiler seems to be choking on. The first is that the compiler chokes on 15% and "15%", with or without the quotes, neither works.
The second is that adding the rectangle doesn't work. I tried all the following, but nothing works.
addChild(aRect);
Application.addChild(aRect);
Application.application.addChild(aRect);
stage.addChild(aRect);
What's the deal, I thought actionscript would be nicer than mxml.