3 Replies Latest reply on Oct 9, 2007 7:20 AM by Newsgroup_User

    * Genius needed: Load external swf at native size?

    |_Matt_|
      Hi,

      I want to load an external swf into a container movie. The swf I am loading in could be any size and any aspect ratio. I have got my code successfully resizing the external swf and making it as large as it can be inside the container movie, maintaining the aspect ratio.

      The problem is the swf comes in showing everything thats within the fla, whether it be within the movie area or not. As an example: I have a swf 800x600 with elements that move from off screen on the left to off screen on the right. The 800x 600 swf comes in 1100x600, showing the off screen elements.

      Does anyone know if there is a way to size the imported swf to its native size? Using a mask to bodge it won't work as the main viewable content area could not be automatically calculated.

      I've seen loads of posts about this issue but no answers!

      Thanks,

      Matt
        • 1. Re: * Genius needed: Load external swf at native size?
          Greg Dove Level 4
          I'm no genius, but I can share your pain.
          I did something similar recently.
          For as2 I could not avoid a publishing requirement of the swf to be loaded. I could only think of two ways to do this:
          1)Designer type requirement: Frame 1 of the swf to be loaded contains nothing other than a sizing clip. The content is on frame 2 and beyond.
          2)Code: the first frame contains two properties _originalwidth and _originalheight which are set in code. They have to be manually set before publishing ( a jsfl command would be good here to automate things).
          Both the approaches should be accessible in an onLoadInit handler for a MovieClipLoader.

          The problem is that there is no property of a swf that offers dimensions for the size of the stage when it was published. At least not for as2.

          The good news is that I think for as3 there is data in the loaderInfo that lets you get this in the loaderInfo... although I haven't actually checked it/tried it.

          • 2. Re: * Genius needed: Load external swf at native size?
            |_Matt_| Level 1
            Thanks GWD.

            I have gone through exactly the same thought process re: passing params across from the external movie and also setting the size on frame 1. Unfortunately I'm using Flash and Zinc to develop a software App so;
            a) I can't use AS3 as Zinc is AS2 based and
            b) The users can choose any swf they have on their system to display inside the app meaning I have no control over it!

            Thanks for the ideas though - I'm not sure there is a solution to this one!
            • 3. Re: * Genius needed: Load external swf at native size?
              Level 7
              That is a tough one. My only _good_ thought on this one is - can Zinc read
              the stage size from the swf when the user selects the file? Kind of a
              pre-open. I'm not sure of Zinc's file capabilities but you could do it with
              Director and one of the Binary fileIO xtras. IIRC, the stage size info
              begins at byte 8 of the SWF. There are a number of swf header readers out
              there that you could use to figure it out, but it may be a moot point if
              Zinc doesn't allow you to read in a binary file.

              --
              Dave -
              Head Developer
              http://www.blurredistinction.com
              Adobe Community Expert
              http://www.adobe.com/communities/experts/