开发者

problem with resizing movieclip inside movieclip in as3

I have two movieclips, one loads an image, I resize that mc and add it in a bigger movieclip which has to be resized too. My problem is that that the inner movieclip doesn't resize the way I want although I've tried many variants of the sequence of the commands. I've also taken into account something that I read that an empty mc resizes strangely but it didn't change anything.

that's the code:

loader_mc.x=0;
loader_mc.y=0;
cont_mc.x=1440;
cont_mc.y=0;

trace(loader_mc.width,loader_mc.width);
var myLoader:Loader = new Loader();

myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderReady);
var fileRequest:URLRequest = new URLRequest("0.jpg");
myLoader.load(fileRequest);

function onLoaderReady(e:Event) {
loader_mc.addChild(myLoader);
cont_mc.addChild(loader_mc);
loader_mc.height=707;
loader_mc.width=500;

cont_mc.height=1000;
cont_mc.width=1440;
}

problem with resizing movieclip inside movieclip in as3

red mc is the outer one but the sizes of the inner are not right it shoul开发者_StackOverflowd be about one third of the outer but it's about two thirds. same with the height.

All I want is to be able to resize them independenlty. with the outter beeing bigger than the inner


the answer is

cont_mc.width = 1440;  
//  set this first 

loader_mc.width = 500 * (1 / cont_mc.scaleX); 
//  loader_mc shows up at 500px on screen  

loader_mc.y = ((cont_mc.height - loader_mc.height*cont_mc.scaleY )/2) * (1 / cont_mc.scaleY);
//center loader_mc inside cont_mc
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜