[as3]
var superCont:SuperCont = new SuperCont();
superCont.width = 100;
superCont.height = 100;

var someObject:SomeObject = new SomeObject();
someObject.width = 20;
someObject.height = 35;

stage.addChild(superCont);
superCont.addChild(someObject);

superCont.width = 154;
superCont.height = 56;

trace(someObject.width); //still returns 20
trace(someObject.height); //still returns 35
[/as3]

Solution:

[as3]
trace(someObject.width*someObject.scaleX);
trace(someObject.height*someObject.scaleY);
[/as3]

The getBounds() method returns the size of something when measured in something else’s coordinate space.

someObject.getBounds(stage) returns the size of someObject relative to stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

Post Navigation