views:

329

answers:

1

hi guys,

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 400

I'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

+1  A: 

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.

Richard Inglis
the "myswf_file1.swf" in my case is 800 X 600 .. yep still breaks.content being loaded is larger than the container.is it a issue with depth?
Amitd
Are you creating container_mc from scratch? If so, try not setting it's size until after your swf has loaded.
Richard Inglis
"container_mc" is placed on the stage ..initially it has loader and then the swfs come in. like a swf player.
Amitd
(I changed my answer - see above)
Richard Inglis