I figured it out, change your onLoadInit function to this:
ActionScript Code:
loading.onLoadInit = function(mc){
// resize here
onEnterFrame = function(){
trace(mc._width+" | "+mc._height);
}
}
and then retest your Movie, and observe the Output panel. You'll see that the size of the external SWF is changing all the time, this is because the SWF is not loaded inside your movieclip with its Flash dimensions, but rather with all its elements. So, if transitions make parts move out of the Stage, those will be visible, and thus extending the size, and when they're gone, the size of the external SWF will contract.
I found this solution on the internet:
Quote:
The problem here is that the loaded swf looses it's stage size when it's loaded into another swf. The stage of the parent becomes the stage of loaded swf. When requesting the size of the loaded swf, like you do, it will return the width and height of the entire surface of the first frame, not that of the stage.
The way I've solved this in the past is to create a movieclip instance on the first frame of the loaded swf with the size of the stage of that swf. Once the swf has been loaded you can then target that swf and get it's dimensions. Of course, this only works if you have publishing control over the swf you're trying to load.
To illustrate this in an example. In your swf to be loaded place a movieclip (e.g. a movieclip of a rectangle) on the first frame and name it stage_mc. When you now load the swf you can target that stage_mc instance like so:
ActionScript Code:
loadHandler.onLoadInit = function(mc:MovieClip) {
trace(mc.stage_mc._width + ", " + mc.stage_mc._height);
}
|