swffit - Smart Flash Resize Script

February 5th, 2010 by Adrian Parr

I remember stumbling across swffit ages ago, but never really gave it much thought at the time. However, a little while ago I put a small Flash site together (www.beauseat.com) for a friend, and it was scaled to fill the browser window. But when you resized the browser down to a small size you lost some of the navigation at the bottom. But today I re-found swffit, and it was just what I needed. It is really easy to use and just works!

Check out the swffit site and Google Code site

Thanks Miller Medeiros

Posted in Flash, HTML |

5 Responses

  1. Adrian Parr Says:

    An alternative to this seems to be SWFsize …

    http://chargedweb.com/swfsize/

  2. jloa Says:

    Yeah, that’s my lib. Well, can’t say it’s an alternative, these two libs are a bit different, but still i use them both ^_^

  3. Arrow Says:

    Can you tell exactly how you put it? Been trying, it’s failing.

  4. jloa Says:

    Well, it’s all listed at the docs: http://chargedweb.com/swfsize/docs.html

    Here’s a sample code on how to include the swfsize in yr project:

    var attributes = {id:’swfID’};
    var flashvars = {};
    var params = {menu:’false’};
    swfobject.embedSWF(’mywebsite.swf’, ‘mywebsite’, “100%”, “100%”, ‘9′, ‘expressInstall.swf’, flashvars, params, attributes);

    // now all you need to do is pass swf’s attributes.id to SWFSize
    swfsize.id = attributes.id;

    That’s it. You just have to implement this line to enabled swfsize:

    swfsize.id = attributes.id;

    And inside your as3 project simple call the singleton construction to initialize the lib:

    // import the SWFSize api
    import com.chargedweb.swfsize.SWFSize;
    import com.chargedweb.swfsize.SWFSizeEvent;

    // initialize SWFSize
    var swfSizer:SWFSize = SWFSize.getInstance();

  5. Adrian Parr Says:

    Hi Arrow,

    I’m not sure if you are trying to use swffit or SWFsize.

    jloa has posted some sample code for using SWFsize above.

    swffit is really straight forward to use too. Firstly, link to the JavaScript file in your HTML …

    <script type="text/javascript" src="lib/js/swffit.js"></script>

    And then you need to call the ‘fit’ method in your JavaScript in your HTML page, and pass the attributeId, minWidth and minHeight …

    swffit.fit("flashBeauSeat",780,510);

    View the HTML source of this page to see what I did …

    http://www.beauseat.com

    I hope that helps.
    The documentation on the swffit site is pretty clear and easy to follow.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.