Rich Rodecker’s blog on flash, flex, actionscript, javascript, and php, with a dash of randomness
SWFObject helper
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:
-
<script type="text/javascript">
-
var so = new SWFObject("movie.swf", "mymovie", "200", "100", "7", "#336699");
-
so.write("flashcontent");
-
</script>
turns into this:
JavaScript:
-
<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.
| Print article | This entry was posted by rich on May 2, 2006 at 10:05 am, and is filed under flash. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about 4 years ago
Sorry, I don't see how that's easier
Your method just adds another file to keep track of.
about 4 years ago
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.
about 4 years ago
...so essentially, its just a config file for swfobject.
about 4 years ago
I think its a nice little add-on rich
anything to make life easier is cool by me, well done.
about 4 years ago
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?
about 4 years ago
i'm sorry, i don't actually know which script you are talking about.
about 3 years ago
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
about 3 years ago
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').
about 3 years ago
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
about 3 years ago
thats cool vineet...but I didn't make SWFObject. You'd need to thank Geoff Stearns.
about 3 years ago
Thanks for the help! it worked gracefully!!!
Fan of Don Lapre
about 2 years ago
Shame, the zip does not appear to be available anymore. I downloaded it but there's nothing packed inside..
about 2 years ago
If a site is using this Swfobject how can one extract the flash movie from it?
For example I subscribe to a site, which I pay for, and I want to down the content to my local hard drive.
How do I do it?
All the download managers out on the net have problems with SwfObject.