MovieClip Resize Problem

Flash AS3 Problem with Resizing MovieClip

Page 1 of 1

0 Replies - 1896 Views - Last Post: 24 June 2010 - 06:14 AM

#1 mensahero  Icon User is offline

  • I Desire...
  • member icon

Reputation: 17
  • View blog
  • Posts: 678
  • Joined: 26-May 08

MovieClip Resize Problem

Posted 24 June 2010 - 06:14 AM

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 also attached the source file. This for Flash CS4 AS3. Please tell me I'm not the only one in the world experiencing this problem. It's been years since I've asked for help but I can't seem to figure this one out even though the idea of what I'm trying to accomplish is really simple. My very tight deadline is killing me.

Thanks in advance..

Is This A Good Question/Topic? 0
  • +

Page 1 of 1