加载的SWF的舞台尺寸 [英] dimensions of loaded swf's stage
问题描述
这里的情况 - 我有一个外壳,加载外部瑞士法郎。现在,这是瑞士法郎800x600的,但它是一个动画片,并有延伸关闭的阶段的元件。当我加载瑞士法郎到外壳并调用其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?
推荐答案
在加载的SWF通过它与可以在装载机$ C可以找到创建的FLA所定义的宽度和高度$ C>对象,在其中您已经加载的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.stageWidth
和 stage.stageHeight
属性将总是返回舞台的宽度,舞台总是最顶端的SWF。换句话说,它总是会重新present壳的舞台的尺寸。只有不断之一,一个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屋!