简体   繁体   English

AS3:设置加载的瑞士法郎的大小

[英]AS3: Setting size of loaded swf

I'm using Loader to load an external swf into my swf and adding that loaded swf to the stage using event.target.content. 我正在使用Loader将外部SWF加载到SWF中,然后使用event.target.content将加载的SWF添加到舞台中。

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. 我想做的是更改已加载的swf的舞台大小。

Any way of doing that? 有什么办法吗?

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: 为了使加载的swf适合该区域,请缩放以使内部的所有内容都可以执行以下操作:

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 如果将Math.min更改为Math.max,则如果尺寸不匹配,则会得到不同的结果

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM