How can I get the width/height of a loaded swf's stage in AS2?
Posted
by loopj
on Stack Overflow
See other posts from Stack Overflow
or by loopj
Published on 2009-06-02T00:42:44Z
Indexed on
2010/03/31
17:23 UTC
Read the original article
Hit count: 237
I'm using MovieClipLoader to load an external as2 swf file into my as2 flash project, and I'm having trouble getting the original stage size of the loaded swf.
When I run the following code:
var popup:MovieClip = _root.createEmptyMovieClip("popup", 1);
var loader:MovieClipLoader = new MovieClipLoader();
var loadHandler:Object = new Object();
loader.addListener(loadHandler);
loader.loadClip(url, popup);
loadHandler.onLoadInit = function(mc:MovieClip) {
trace(mc._width + ", " + mc._height);
}
I get strange width/height values (mc._width=601.95, mc._height=261.15) when what I actually want is the stage size of the loaded swf file, which in this case I know to be 300px x 250px.
Any suggestions appreciated! Thanks
© Stack Overflow or respective owner