I'm loading a flash MovieClip (Test.swf) like below.
The problem is I can't read the size of mc (mc.width and mc._width both return 0, for the height as well), but I need to scale it. I have the stage s开发者_Go百科ize, I can scale, but I don't have the size of Test.swf, so I can't scale it to fit into the stage...ActionScript2, not actionscript3. If it was 3, I could get the value from the loader, but with as2??? The problem is I don't have control over the swf I load, so I can't put it's dimensions in the first frame...
var mcImageToCrop:MovieClip ;
var mc:MovieClip;
mc = this.createEmptyMovieClip("mc", this.getNextHighestDepth());
mc._x = 30;
mc._y = 30;
mc.opaqueBackground = 0xF0F0F0;//0xCCCCCC;
mcImageToCrop = mc.createEmptyMovieClip("mcImageToCrop", mc.getNextHighestDepth());
// mcImageToCrop._width = Stage.width;
// mcImageToCrop._height = Stage.height;
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);
//load the tower movie clip
mcLoader.loadClip("Test.swf", mcImageToCrop);
Did you try within the onLoadInit event to get the right dimension ?
..
function onLoadInit(myMc)
{
trace ("Movie clip:" + myMc +":" + myMc._width+"x"+myMc._height);
}
..
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);
mcLoader.loadClip("Test.swf", mcImageToCrop);
精彩评论