swffit (formerly know as FitFlash) is a smart script that resizes your flash movie automatically if your browser window size is smaller or greater than your flash minimum desired size keeping it accessible independent of screen resolution.
Download swffit (released 03/27/2008) - SWFObject 2.0 Download FitFlash 2.5 (released 01/23/2008) - SWFObject 1.5Why?
swffit was made to improve accessibility of your flash website.
It was made because each user uses a different screen resolution and resizes the browser window at custom sizes.. when you set the flash size to 100% (width and/or height) the browser won't generate scrollbars and maybe an important content will be hidden for the user.
What it does?
swffit automatically resizes your flash to 100% width and 100% height when your browser window is greater than the minimum desired size and resizes flash to the minimum desired size when the browser window is smaller... It can also resize the flash movie to a maximum size if the browser window size is greater than the maximum size...
How do i use it?
Include the swffit.js Javascript file, then just call one simple javascript function.
Example:
<script type="text/javascript" src="swffit.js"></script>
<script type="text/javascript">
<!--
swffit("my_flash", 1000, 590);
//-->
</script>
Arguments:
flash ID - The ID of the flash object/embed tag.
minWidth - Minimum desired width (px) for your flash.
minHeight - Minimum desired height (px) for your flash.
maxWidth (optional) - Maximum desired width (px) or 'null'.
maxHeight (optional) - Maximum desired height (px) or 'null'.
centered (optional) - Sets if the flash will be centered (horizontally and vertically) after reach maximum size, default value is true (boolean: true or false).
Tips:
If you want to set a max size for only one axis ('maxWidth' or 'maxHeight') set the other one as null.
If you set any value equal to '0' (except for 'centered') swffit won't work properly..
Copy the example page that comes with the swffit.zip file and just change what you need, this is the easiest way to avoid bugs.
Example Pages
- Basic Example Page (Dynamic Publishing)
- Basic Example Page - Static (Static Publishing)
- Example Page With Maximum Size - Centered (Dynamic Publishing)
- Example Page With Maximum Size - Not Centered (Dynamic Publishing)
Ps: To learn the differences between swfobject Static and Dynamic Publishing read the SWFObject 2.0 Documentation
Is it crossbrowser?
I tested it on mac (safari, firefox, opera, mozilla) and pc (ie, firefox, opera, safari, netscape) and worked well.. I think it should work in every browser that supports javascript..
Download
Download the latest version of swffit. You can use it for whatever you want with no restrictions just keep the credits in the swffit.js file. This software is released under the MIT License
Download swffit (released 03/27/2008) - SWFObject 2.0 Download FitFlash 2.5 (released 01/23/2008) - SWFObject 1.5I recommend
I recomend using swffit and SWFObject 2.0 instead of FitFlash 2.5
Why I've changed the name from FitFlash to swffit?
I've changed the name from FitFlash to swffit because Simurai advised me to change it since Adobe asked Geoff Stearns to change FlashObject name to SWFObject (due to legal/trademark reasons) and also because now it only works with swfobject 2.0 that from now is also writen in lowercase.
Thanks
Thanks to everybody that helped me with ideas to improve swffit and also the ones that helped me spreading it allover the web.. Here is some of them: Ajaxian, PHPSpot, Zeh, Bildirgec, Best Flash Animation Site, Developer0000, Xyberneticos and many more...
Who made it and Why he did?
swffit was made by Miller Medeiros. I had the idea when i was making my own portfolio in July/2006 and wanted to use the flash with 100% width and 100% height. By that time i didn't found any script that can do what swffit does and i decided to code it by myself..
