Think2Loud

09 Sep, 2008

Add Scroll Bars to Full Browser Flash with a Simple jQuery Plugin

Posted by: Josh In: JavaScript

Got a great Flash site? Can it be used by someone with low resolution? This plugin offers an easy way to keep your full browser Flash from getting too small.

Source: (.zip) (.js only) | Demo

The first thing you need to do is get jQuery set up and running. Once you have that done, I recommend the jQuery Flash Plugin for embedding your Flash movies, but you can use any method you like. Now you need to download and include the jQuery FlashResize Plugin.

With the plugin included and ready to use, we need to get it running. You will need to have an element to use as your placeholder. The body tag can be used, but I always use a container element, usually a div.

<body>
     <div id="flash-scroll">
          <p>Html to be replaced by 100% Flash.</p>        
     </div> 
</body>

With the HTML set up for the scroll bars, you simply need to add the call to the FlashResize plugin in the document.ready function. The plugin only has two parameters minWidth and minHeight. If you don’t specify a value, then the Flash container is set to 100% and no scroll bar is added.

So just set the parameters to your minimum values and that’s it. As you can see below, the Flash has been set to a minimum of 800 by 750.

$(document).ready(function() {
	$('#flash-scroll').flashResize({
  		minWidth: 800,
  		minHeight: 750
	});
});

If you would like to see this plugin in action, check out the demo.

Source: (.zip) (.js only) | Demo

11 Responses to "Add Scroll Bars to Full Browser Flash with a Simple jQuery Plugin"

1 | Wai Man wong

September 9th, 2008 at 11:10 pm

Avatar

Whoa! Great tute. I need to implement this on my own site. Thanks.

View Wai Man’s profile

2 | Bruce Robertson

September 15th, 2008 at 11:05 pm

Avatar

Sweet! This is exactly what I needed. Indeed a great tutorial. Much thanks.

4 | jorge mejia

November 10th, 2008 at 2:52 pm

Avatar

help any one!
it works great on my local server but doesn’t when i upload it to my web sever. i don’t understand.

5 | Josh

November 10th, 2008 at 2:55 pm

Avatar

@jorge Do you a link so i could see it?

6 | jorge mejia

November 10th, 2008 at 4:02 pm

Avatar

it doesnt seem to load the .swf
http://lavena.com.mx/

7 | Josh

November 10th, 2008 at 4:18 pm

Avatar

Looks like your swf is not on the server. if i try and just load

http://lavena.com.mx/lavena.swf

nothing comes up.

8 | jorge mejia

November 10th, 2008 at 8:04 pm

Avatar

i figure it out… it was a silly mistake, the .swf file was call LaVena.swf instead of lavena.swf so it wouldnt load, i didn’t know it’d be case sensitive, the funny thing was it worked on my computer and when i uploaded the whole thing to another server it worked just fine there too.
Thanks a lot for your help i really appreciate.

9 | ptriek

November 14th, 2008 at 6:06 am

Avatar

thanks for your interesting post - i tried it in combination with swfobject - everything works fine - except when i maximize the browser window in Firefox, the swf disappears.
any thoughts?

11 | Josh

November 14th, 2008 at 8:31 am

Avatar

@ptriek

It is the container div that is causing you problems. You may want to have the flashResize function attached to the container div instead of the content div. You will also need to set your flash to 100% in the swfobject.

Comment Form