views:

512

answers:

1

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 size, 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);
+2  A: 

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);
Patrick
Curious, onLoadInit not in mcLoader, not in mc, but in this inside of the function works. Crude, don't know why it works, but it does... this.onLoadInit = function (target_mc:MovieClip) { trace("Onloadinit: Width: " + target_mc._width + " height: " + target_mc._height); }
Quandary