Greetings,
I’m Just learning FLASH AS3 for about 3 weeks now and I’m stuck on this very simple problem. I want to resize a MovieClip (Image) to fit inside another MovieClip (LayoutArea). The problem is when I dynamically resize the movieClip the movieClip is way smaller than the supposed to be size. I use trace to check for the size and it shows the correct size but the display is not correct.
example: trace results - width = 220, height = 220 . Actual Displayed MovieClip = approx. width = 50, height = 50 .
Heres the affected code :
function setImageInsideLayoutArea(a:Object, b:Object) : void {
if(b.height > b.width) {
a.width = b.width;
a.height = b.width;
} else {
a.width = b.height;
a.height = b.height;
}
alignCenter(a, B);
}
Heres the whole code:
layoutArea.width = 220;
layoutArea.height = 150;
var xx:addedDesignMc = new addedDesignMc;
xx.image.addEventListener(Event.COMPLETE, imageLoaded);
xx.image.source = "Designs/designs/1.png";
function imageLoaded(e:Event) :void {
stage.addChild(xx);
setImageInsideLayoutArea(xx, layoutArea);
}
function setImageInsideLayoutArea(a:Object, b:Object) : void {
if(b.height > b.width) {
a.width = b.width;
a.height = b.width;
} else {
a.width = b.height;
a.height = b.height;
}
alignCenter(a, B);
}
function alignCenter( objectA: Object , objectB: Object) {
objectA.x = (objectB.width/2 - objectA.width/2) + objectB.x;
objectA.y = (objectB.height/2 - objectA.height/2) + objectB.y;
}
Other details:
First MovieClip that needs to be resized contains a uiLoader for loading images.
I can’t attached the source file due to attachment size limitation.
Thanks in advance…