Skip to Content »

FlashApe » SWFObject helper

 SWFObject helper

  • May 2nd, 2006
  • 10:05 am

As if SWFObject wasn't easy enough to use on its own, i created a little helper js file to use with it, it's like a little 'cheat sheet'. It lists all the possible variables and parameters that need to be set for SWFObject, and also lists all the possible parameters for the object/embed tags. I just created this so you don't need to go searching through any docs (either SWFObject's or macrome adobe's) to find the information you need.

Download here: js_swfo_helper.zip

Usage: All you're doing is including is including the swfobject_helper.js file in place of the the normal swfobject embedded script, so this:

JavaScript:
  1. <script type="text/javascript">
  2. var so = new SWFObject("movie.swf", "mymovie", "200", "100", "7", "#336699");
  3. so.write("flashcontent");
  4. </script>

turns into this:

JavaScript:
  1. <script type="text/javascript" xsrc="swfobject_helper.js"></script>

Then you just crack open the swfobject_helper.js file and set any parameters you need.

12 People had this to say...

Gravatar
  • felix
  • May 2nd, 2006
  • 11:22 am

Sorry, I don't see how that's easier :( Your method just adds another file to keep track of.

Gravatar
  • rich
  • May 2nd, 2006
  • 12:00 pm

yeah, it is one more file to keep track of, but its easier as far as having all the options available right there in the page...setting params is just changing variable names in the script. It's more of a 'don't make me think' issue....no big deal. If you are already comfortable using SWFObject the way it is, that's great, continue to us it as is. It was just easier for me to say to someone else 'change these variables to what you want' rather then telling someone how to use the methods and sending them to the documentation.

Actually, that was just preparation for my next posting about SWFObject, coming up shortly.

Gravatar
  • rich
  • May 2nd, 2006
  • 12:57 pm

...so essentially, its just a config file for swfobject.

Gravatar
  • Darren
  • May 17th, 2006
  • 12:50 am

I think its a nice little add-on rich :)
anything to make life easier is cool by me, well done.

Gravatar

I'm trying to use the swfobject in conjunction with the flash_resize.js script, but I can't seem to get it right. I've looked everywhere. Do you have any advice?

Gravatar
  • rich
  • June 15th, 2006
  • 11:43 am

i'm sorry, i don't actually know which script you are talking about.

Gravatar

I've been struggling with this whole SWFObject-thing for a while now and I think the problem I'm having (even WITH your swfobject_helper.js file) is that I'm not sure how to pass the variables* to the Flash movie.

* The variables I'm trying to use point to Playlists:
so.addVariable("FlashVars", "playlist.xml");

Thanks,
sw

Gravatar
  • rich
  • August 21st, 2006
  • 8:12 am

the addVariables() method adds a variable with the name you specify onto the FlashVars parameter, so you're going about it a little bit wrong..it should be something like:

so.addVariable('myXMLFile', 'playlist.xml');

then when your movie loads you will have a variable on the_root timeline with a name of 'myXMLFile', whose value will be 'playlist.xml' (so you would have _root.myXMLFile = 'playlist.xml').

Gravatar

Just want to say thank you for the SWFObject. I made a small You tube player.

I also figured out a way to reuse the SWFObject by using the following -

function changeYouTube(temp){
so.setAttribute(’swf’, temp);
so.write("flashcontent");
}

See it at -
http://padmanijain.googlepages.com/myexperiments

vineet
http://padmanijain.googlepages.com/myexperiments

Gravatar
  • rich
  • November 10th, 2006
  • 10:23 am

thats cool vineet...but I didn't make SWFObject. You'd need to thank Geoff Stearns.

Gravatar
  • Fan of Don Lapre
  • December 6th, 2006
  • 4:44 pm

Thanks for the help! it worked gracefully!!!

Fan of Don Lapre

Gravatar
  • Jim Amos
  • April 7th, 2008
  • 7:25 am

Shame, the zip does not appear to be available anymore. I downloaded it but there's nothing packed inside..

Want your say?

* Required fields. Your e-mail address will not be published on this site


You can use the following XHTML tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>