dimensions of loaded swf's stage

前端 未结 2 1423
臣服心动
臣服心动 2021-01-05 02:50

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 s

相关标签:
2条回答
  • 2021-01-05 03:28

    Mark is very likely right that the content loader info object will contain the correct width and height. I've never checked myself so I can't guarantee it. The docs say 'nominal' and contrast it with 'actual' so it seems reasonable.

    There are a couple of other options. You can mask the external swf. Create a mask that is the size of the stage and put all content underneath it. Another idea is to create a movieclip based on a rectangular shape set it's alpha to 0 place it at x:0, y:0 and match it's width and height to stage. Give it an instance name and then when it is loaded use that value for the size.

    0 讨论(0)
  • 2021-01-05 03:40

    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
    

    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.

    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.

    0 讨论(0)
提交回复
热议问题