Planet Claire

some say she's from Mars

Cropping swf to fit div of different ratio

by Claire 11/16/2009 1:44:00 PM

I found adobe's documentation very confusing here, a typo oft copied & pasted on the web just wasted over an hour of my time, grrr!!

Here's the story:  I've got a website where I'm tiling an .swf file.  As it happens the width of the div isn't an exact multiple of the width of the .swf so the last instance of the swf's got to be cropped.

The parameter of the object tag to use is "scale".  You need to set it to "noborder".  Not "noorder"!!

So, using swfobject, here's my code that crops the swf:

    <script type="text/javascript">
        var flashvars = {};
        var params = { wmode: "opaque", scale: "noborder" };
        var attributes = {};
        swfobject.embedSWF("/flash/grass.swf", "grass5", "145", "46", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
    </script>

Note the width of the flash file is 197px and it's cropped to 145px.  That's all that's needed. 

Now if anyone can tell me how to tile an .swf across a div without having to embed the .swf on multiple tiled divs within the main div....?

Tags: ,

Tech