[as3]
function setRegPoint(obj:DisplayObjectContainer, newX:Number, newY:Number):void {
//get the bounds of the object and the location
//of the current registration point in relation
//to the upper left corner of the graphical content
//note: this is a PSEUDO currentRegX and currentRegY, as the
//registration point of a display object is ALWAYS (0, 0):
var bounds:Rectangle = obj.getBounds(obj.parent);
var currentRegX:Number = obj.x – bounds.left;
var currentRegY:Number = obj.y – bounds.top;

var xOffset:Number = newX – currentRegX;
var yOffset:Number = newY – currentRegY;
//shift the object to its new location–
//this will put it back in the same position
//where it started (that is, VISUALLY anyway):
obj.x += xOffset;
obj.y += yOffset;

//shift all the children the same amount,
//but in the opposite direction
for(var i:int = 0; i < obj.numChildren; i++) {
obj.getChildAt(i).x -= xOffset;
obj.getChildAt(i).y -= yOffset;
}
}
[/as3]

[as3]
import flash.display.Bitmap;
import flash.display.Loader;
import fl.controls.Button;
import flash.net.FileReference;
import flash.net.FileFilter;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.events.MouseEvent;
import flash.utils.ByteArray;

// initializing FileReference
var imageFilter=new FileFilter("Images", "*.jpg;*.jpeg;*.gif;*.png");
var fileR:FileReference=new FileReference();
fileR.addEventListener(Event.CANCEL, cancelHandler);
fileR.addEventListener(Event.SELECT, selectHandler);
fileR.addEventListener(ProgressEvent.PROGRESS, progressHandler);
fileR.addEventListener(Event.COMPLETE, completeHandler);

// creating button using Flash component
var pickbutton:Button=new Button();
pickbutton.x=pickbutton.y=10;
pickbutton.label="Select Image";
pickbutton.addEventListener(MouseEvent.CLICK,selectImage);
addChild(pickbutton);

function selectImage(e:MouseEvent):void{ // click button
fileR.browse([imageFilter]); // browse files
}
function selectHandler(e:Event):void{ // file selected
trace("selectHandler: "+fileR.name);
fileR.load(); // load file
}
function cancelHandler(e:Event):void { // cancel select
trace("cancelHandler");
}
function progressHandler(e:ProgressEvent):void { // progress event
trace("progressHandler: loaded="+e.bytesLoaded+" total="+e.bytesTotal);
}
function completeHandler(e:Event):void { // file loaded
trace("completeHandler: " + fileR.name);
var ba:ByteArray=fileR.data; // get data
var loader:Loader=new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loaded);
loader.loadBytes(ba); // load with Loader
}
function loaded(e:Event):void{ // bitmap loaded
while(numChildren>1){ // remove any previous bitmaps on stage
removeChildAt(0);
}
var bm:Bitmap = e.currentTarget.loader.content as Bitmap;

// resize bitmap if larger than stage
if(bm.width>stage.stageWidth||bm.height>stage.stageHeight){
var xscale:Number=stage.stageWidth/bm.width;
var yscale:Number=stage.stageHeight/bm.height;
if(xscale<yscale){
bm.scaleX=bm.scaleY=xscale;
}else{
bm.scaleX=bm.scaleY=yscale;
}
}

// center bitmap
bm.x=Math.abs(bm.width-stage.stageWidth)/2;
bm.y=Math.abs(bm.height-stage.stageHeight)/2;

// add to bottom
addChildAt(bm,0);
}
[/as3]

[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.