Im trying to load series of external Swfs into a Movieclip on stage. The swf are 800 x 600 in dimension whereas as the container is 400 X 400.
Whenever i try to load the external swf in the container,the container takes the size of the loaded swf instead of 400 x 400 .How can i overcome this?
I want to any swf loaded into the container to be 400 x 400I'm using the following code :
开发者_如何学运维 var movLoad:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();
myListener.onLoadInit = function(thisMc:MovieClip) {
thisMc._height = 400;
thisMc._width = 400;
};
movLoad.addListener(myListener);
btnNext.onPress = function()
{
loadSwf("myswf_file1.swf");//will change name accordingly.
}
function loadSwf(swf)
{
movLoad.loadClip(swf, container_mc);
// myswf1.swf is a swf which could be of any size .
// container_mc is movieclip on stage.
//container_mc has dimension 400 x 400
}
thx amit
EDIT (new answer):
I think the problem is that your loaded swf retains the previous _xscale
and _yscale
properties of container_mc.
If you tried to set container_mc._width
and ._height
when container_mc was an empty clip, then flash (bizarrely) changes it's scale to zero - when your swf loads, it also has zero scale, so setting the _width
and _height
has no effect.
You could test this with trace("scale = "+thisMc._xscale+" x "+thisMc._yscale);
The fix would be to put something into container_mc (say a 400x400 square) initially. You could hide it until your swf loads.
精彩评论