3 Replies Latest reply on Aug 10, 2006 3:45 PM by Newsgroup_User

    problem with scaling externally loaded SWFs using loadClip

    Level 7
      Hey All,

      I am builidng a player in Flash MX 2004 which will show externally loaded
      SWFs to the user. One SWF at a time. The user is going to have back-next
      type navigation controls. Thats all. Simple.

      But I am facing a wierd problem in loading external SWFs. I want to be able
      to resize the external SWFs into a fixed area while maintaining the aspect
      ratio of the loaded SWF. This action is happening unreliably for me. In some
      SWFs, my solution is working fine and in some it is not. Result is that I am
      sometimes getting SWFs which are smaller in size than what I want (as in
      they dont fill up whole viewable area even when they can). Note that this is
      happening only in some SWFs and not all of them.

      I am tempted to think that this might be because some SWFs are somehow
      different than the SWFs which work fine. But I am clueless what this
      difference could be. All external SWFs have only one frame. And there
      framerate is also same. I am resizing all SWFs in loadClip.onLoadInit. The
      resizing code tries to fit the loaded SWF into a fixed area while
      maintaining its aspect ratio.

      I have tried using MovieClip.loadClip and also the Loader component that
      comes with Flash MX 2004.

      Is there anything which I am missing out here, or could there be any
      attribute in the external SWF which might make it behave differently than
      others when resized.

      Kindly help me. This issue is really giving me jerks now. Thanks!

      Regards,
      Kapil Mohan


        • 1. Re: problem with scaling externally loaded SWFs using loadClip
          DazFaz Level 1
          can you email me your problem as so I can take a look dazfaz at hotmail.com
          • 2. Re: problem with scaling externally loaded SWFs using loadClip
            Rothrock Level 5
            Of course questions like this are much easier to answer when the code is in front of one.

            Are you loading the external swfs into the same MovieClip? If you are then you might want to reset the _xscale and _yscale to 100 before you get the _width and _height of the newly loaded clip.

            If you have things on your eternal swf that are "off the stage" they will be included in the size of the external file or alternately if you only have one small item in the middle of the screen (or some such) the width and height will reflect that as well. There is no property of a published swf that tells you what its stage dimensions were supposed to be. So unless you include that or make sure that the first frame of the clip has a rectangle the size of the stage you will get "interesting" results sometimes.
            • 3. Re: problem with scaling externally loaded SWFs using loadClip
              Level 7
              Hi all,

              I think I'm facing a similar kind of problem.
              In essence I have 3 swfs.
              The first is the container.swf - this loads in two swfs using the following
              code,

              var swfloader:MovieClipLoader = new MovieClipLoader();

              swfloader.loadClip("bg.swf","_root.emptybg");
              swfloader.loadClip("maincontent.swf","_root.emptybg2")

              It has publish settings of 100% for width and height, and scale is "exact
              fit".

              The desired effect is that bg.swf should completely fill the browser window,
              whilst maincontent.swf sits ontop of bg.swf.

              Now, bg.swf fills the window fine when loaded in on its own BUT when
              maincontent.swf is loaded aswell, bg.swf fails to fill the entire window.

              I suppose the desired effect is something between this....
              http://www.hi-res.net/
              and this
              http://www.firstflash.net/
              (see the way the background and content seem 'independant of each other when
              the window is resized)



              Any ideas guys... ?













              "Kapil Mohan" <kapil@uzanto.com> wrote in message
              news:ebencj$o8f$1@forums.macromedia.com...
              > Hey All,
              >
              > I am builidng a player in Flash MX 2004 which will show externally loaded
              > SWFs to the user. One SWF at a time. The user is going to have back-next
              > type navigation controls. Thats all. Simple.
              >
              > But I am facing a wierd problem in loading external SWFs. I want to be
              > able
              > to resize the external SWFs into a fixed area while maintaining the aspect
              > ratio of the loaded SWF. This action is happening unreliably for me. In
              > some
              > SWFs, my solution is working fine and in some it is not. Result is that I
              > am
              > sometimes getting SWFs which are smaller in size than what I want (as in
              > they dont fill up whole viewable area even when they can). Note that this
              > is
              > happening only in some SWFs and not all of them.
              >
              > I am tempted to think that this might be because some SWFs are somehow
              > different than the SWFs which work fine. But I am clueless what this
              > difference could be. All external SWFs have only one frame. And there
              > framerate is also same. I am resizing all SWFs in loadClip.onLoadInit. The
              > resizing code tries to fit the loaded SWF into a fixed area while
              > maintaining its aspect ratio.
              >
              > I have tried using MovieClip.loadClip and also the Loader component that
              > comes with Flash MX 2004.
              >
              > Is there anything which I am missing out here, or could there be any
              > attribute in the external SWF which might make it behave differently than
              > others when resized.
              >
              > Kindly help me. This issue is really giving me jerks now. Thanks!
              >
              > Regards,
              > Kapil Mohan
              >
              >