3 Replies Latest reply on Jun 3, 2011 5:41 PM by Rothrock

    How to  affect size of movies using loadMovie CS4, as3


      I have loaded a .swf into my main timeline, but it's quite large. I am trying to get it to fit in the constraints of my current movie. I have read that by putting it into a movie clip, it will constrain to that dimension. How do I accomplish this?

        • 1. Re: How to  affect size of movies using loadMovie CS4, as3
          Rothrock Level 5

          Not sure what you are talking about. First there is no loadMovie in AS3. So I suspect you are actually using AS2?


          And it is a bad idea to replace your main timeline when loading outside assets. You should be loading into a movieclip (or loader instance if you are actually using AS3).


          And you have read wrong. When you load external content into a movieclip it doesn't assume the size of the movieclip. Rather the movieclip assumes the size of the newly loaded content.


          If you want to scale externally loaded content you need to wait until it is loaded and then you can set the scale or width/hieght properties of the movieclip.


          If you are actually using AS2, then you should look into using the MovieClipLoader class instead of the loadMovie function. MCL allows you to listen for events such as onLoadInit which is when you can scale the content.

          • 2. Re: How to  affect size of movies using loadMovie CS4, as3
            Tonezone Level 1

            Thanks for your reply. As you can tell, I am a newbie (actually, I was pretty good in Flash several versions ago, but as3 seems very

            difficult to me). Here's what I am trying to do:


            I have a swf file called banner.swf. I want to load that into a slideshow I am creating called slideShow.fla. I am using as3 and this code:


            var loader:Loader=new Loader();
            loader.load(new URLRequest("banner.swf"));


            my banner.swf loads up just fine in slideShow, but it is so large, I can only see the top left corner of it. i want it to fit inside the constraints of slideShow.fla. What is the best way to do this?

            • 3. Re: How to  affect size of movies using loadMovie CS4, as3
              Rothrock Level 5

              If you know what scaleX and scaleY you will need you could just add it your code. Something like this:




              But if the content you will load is of different sizes and will maybe need different scales you could use code like below.


              import flash.display.Loader;

              import flash.events.Event;

              import flash.display.MovieClip;

              import flash.net.URLRequest;


              var loader:Loader=new Loader();

              loader.contentLoaderInfo.addEventListener(Event.COMPLETE, handleComplete)

              loader.load(new URLRequest("banner.swf"));



              function handleComplete(e:Event){

              var target:Loader=Loader(e.currentTarget.loader);




              Depending upon what you need to do you could change that trace to some kind of measurement of the width and then use some arithmetic to scale the clip to a specific size.