0
votes

Here's one for the maths demons out there!

I have an as3 app that loads SWF's with various movie clips inside with a size of 1280 width and 720 height. I would like to fit these SWFs into a content box of height 885 width by 500 height. The SWF must keep a ratio of 1.77. This would be easy if as3 recognised the SWF being 1280 height by 720 width. It doesn't however, and takes the size of the movie clips inside the swf which varies (as long as it's within the original size boundaries).

Does anyone know how I can make the SWF's fit into the content box even if the movie clip sizes and therefore the original SWF sizes vary?

Thanks

1
I'm not entirely sure I understand the question. Are the loaded SWFs all of size 1280x720 or are their size varying? Because if you know that all the loaded SWFs have the dimension 1280x720 you could just scale them down to 885x500 and that would keep the ratio intact.Bakapii
I think the problem is that his SWFs only have content in certain areas, so setting width = 885 is not working because it's set the width of the contents, not the width of the entire swf. The trick is the calculate and set the scale, not the width and height (see below).Cadin

1 Answers

0
votes

If you know the original size and it will always be the same then you can just set the scale manually based on the ratio between the original size and the target size.

885 / 1280 = .69140625
500 / 720 = .694444444

so you can just do:

mySwf.scaleX = mySwf.scaleY = .69;

And it should be scaled properly.