Hi, I was wondering if you could help me with this doubt I have with addChild(), since all the info I’ve found don’t help me much, for example I have this code :
private var _roundRect:miClass;
private var _width:Number;
private var _height:Number;
publich function createRect():void{
_roundRect = new miClass(_width,_height);
_roundRect.start();//this just draws a block, and place a text,
addChild(_roundRect);
}
public function updateRect($w:Number,$h:Number):void{
_width=$w;
_height=$h;
createRect();
}
when I test this, first I create the rect, then it is added to the screen using addChild, then if I call update the addChild adds a new instance of rect, which is weird since I’m not creating a new object, I’m just changing the properties of a private var, but I get a new visible object on the screen, as I’ve read on flash doc addChild just move a object on the screen if it is already there, for example using flash and I place and object in the stage, then I create other object a sprite and I use spritename.addCHild(objectOnTheStage) the object gets moved no duplicated, on flash documentation it also says that addchild is used to move an object over all the objects of a container, it is not get duplicated, it is moved, this is driving me a little crazy, could you please give me an explain or show me a link which explains this better, I’ve checked a lot on the web but no luck.
Thank u so much. Oscar.