5 Replies Latest reply on Nov 3, 2010 8:24 AM by Ned Murphy

    Cropping a SWF


      Does anyone know a way to crop a SWF like you would crop an image in Photoshop? I'm building a Flash Banners application in my Flash portfolio website and I'm loading a SWF using addChild via a URL loader object. There is no way to mask the outsides of the SWF because addChild puts the SWF at the front of the display list so the masks would just show up anyway and the masks will just be huge white sheets that will look dreadful. I need to LITERALLY crop the SWF down to 550 X 325 pixels. Does anyone know a way to do this?


      Many thanks. NT

        • 1. Re: Cropping a SWF
          Ned Murphy Adobe Community Professional & MVP

          If I am reading your posting correctly, masks are not what you seem to consider them to be.  They do not appear in a file, they are invisible, defining an area where content will appear beneath them.

          • 2. Re: Cropping a SWF
            NewtonsTree Level 1

            Are you saying that if I make a huge mask correctly in the .FLA with a 550 X 325 pixel hole punched in the centre of it, that it will export the SWF to those exact dimensions? It's my fault for the way I built it, but what I'm getting now is huge overflow outside the SWF size. I thought making a mask would just give me a huge white sheet, which is equally ugly.

            • 3. Re: Cropping a SWF
              Ned Murphy Adobe Community Professional & MVP

              You are talking about a frame, not a mask.  A mask would be the piece you cut out, not what's left over around it.


              You can apply the mask in the file you are loading the swf into.  Just create a rectangle that is 550x325, convert it into a movieclip and give it an instance name (say, theMask).  Locate that rectangle to cover the area where your swf will load and assign it as a mask using code.


              yourLoaderName.mask = theMask;


              Only what is within that rectangle will appear.


              You could also do the masking in the swf itself, though it requires getting all the content/layers to be masked.  Masking the loaded file is usually easier.

              • 4. Re: Cropping a SWF
                NewtonsTree Level 1

                You are THE MAN. That works beautifully, thank you so much!! Are there any books for picking up VERY useful tricks like this that you'd recommend? I've read a handful - Colin Moock and Keith Peters and Design Patterns for AS3 - The Adobe guides to Flash, etc. I've got Safari Books online. Just wondered if there's any Flash / AS3 books you've found good? Thanks again for this. An invaluable bit of know-how! Cheers. NT

                • 5. Re: Cropping a SWF
                  Ned Murphy Adobe Community Professional & MVP

                  I don't want to downplay the usefulness of books, but I do not use them.  I don't like reading texts.  So I cannot recommend any.  For myself, what I know comes from hands-on experience and helping in these forums.  When I need to solve some design problem, I usually first turn to the Flash help documentation.  If I cannot find what I need there, then I turn to Google.  Between those two, while it might require some tinkering, I am rarely left hanging.