加载的 swf 舞台的尺寸 [英] dimensions of loaded swf's stage

查看:22
本文介绍了加载的 swf 舞台的尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情况是这样 - 我有一个加载外部 .swf 的 shell.现在,那个 .swf 是 800x600,但它是一个动画片段,并且有一些元素延伸到舞台之外.当我将 .swf 加载到 shell 并调用它的 width 属性时,它返回 1200 - 因为它包括脱离舞台的元素.

Here's the situation - I've got a shell that loads an external .swf. Now, that .swf is 800x600, but it's an animation piece, and there are elements that extends off the stage. When I load the .swf into the shell and call its width attribute, it returns 1200 - because it's including the elements that break out of the stage.

这不是我想要的 - 理想情况下,会有两个属性,一个返回计算宽度",一个返回默认宽度".这些属性是否存在,如果不存在,最好的解决方法是什么?

This isn't what I want - ideally, there would be two properties, one to return the 'calculated width' and one to return the 'default width'. Do these properties exist, and if not, what's the best workaround?

推荐答案

由 FLA 定义的加载 SWF 的宽度和高度可以在 Loader 对象中找到,其中您已将 SWF 加载到其中.

The width and height of the loaded SWF as defined by the FLA it was created with can be found in the Loader object in which you've loaded the SWF into.

swfLoader.contentLoaderInfo.width
swfLoader.contentLoaderInfo.height

这将始终显示在 FLA 属性中定义的尺寸.是否有任何图像、电影剪辑或您从舞台上延伸出来的东西都没有区别.

This will always show you the dimensions as defined in the FLA properties. It makes no difference if any images, MovieClips, or what have you extend off the stage.

stage.stageWidthstage.stageHeight 属性将始终返回舞台的宽度,舞台始终是最顶部的 SWF.换句话说,它总是代表外壳舞台的尺寸.Flash 应用程序中只有一个阶段.

The stage.stageWidth and stage.stageHeight properties will always return the width of the stage, the stage is always the top most SWF. In other words, it will always represent the dimensions of the shell's stage. There is only ever one stage in a Flash application.

这篇关于加载的 swf 舞台的尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆