views:

892

answers:

1

I'm using Loader to load an external swf into my swf and adding that loaded swf to the stage using event.target.content.

If i set the width and height of the loaded swf I actually resize the movieclip inside my loaded swf. What I wanna do is change the stage size of the loaded swf.

Any way of doing that?

+1  A: 

Hi Tinelise

The best way to find the scale you need is to compare the ratios of the width and height scales of the content and the target. To make the loaded swf fit within the area, scaling so that everything is inside you can do something like this:

var scale:Number = Math.min( _holder.width / _loader.content.width,
                            _holder.height / _loader.content.height );
_loader.content.scaleX = _loader.content.scaleY = scale;

This will make sure that you can see everything. If you change Math.min to Math.max, you will get a different result if the dimensions don't match

danjp
Thanks! Seems to work perfect :)
Tinelise