• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Is anyone familiar with swfobject?


Senior Member
Hi everyone,

Im using swfobject 2.2 (deconcept You’ve got your good thing, and I’ve got mine SWFObject: Javascript Flash Player detection and embed script) and want to use it to include a flash mp3 player on my page (MP3 Player).

the standard code given in the documentation for the flash mp3 player is as follows:
<object type="application/x-shockwave-flash" data="player_mp3.swf" width="200" height="20">    <param name="movie" value="mp3_player_file.swf" />    <param name="FlashVars" value="mp3=mp3_name.mp3" /></object>
im not sure how to 'translate' the above line including the FlashVars, and put it into the code below, using swfobject, which is different to the code given in the documentation for the mp3 player, example here embedding using swfobject:

In the head section of page:
<script src="js/swfobject.js" type="text/javascript"></script> <script type="text/javascript">    swfobject.registerObject("video", "9");    </script>
In the body:
 <object id="video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="328" height="290">          <param name="movie" value="the_movie_file.swf" />          <!--[if !IE]>-->          <object type="application/x-shockwave-flash" data="the_movie_file.swf" width="328" height="290">          <!--<![endif]-->            <p>Oops - looks like you don&rsquo;t have Flash player Please <a href="http://get.adobe.com/flashplayer" target="_blank" rel="nofollow">click here</a> to install Flash Player.</p>          <!--[if !IE]>-->          </object>          <!--<![endif]-->      </object>
can anyone help me out here? :S im not a flash designer but want to use swfobject for accessibility.. would v v much appreciate help..

Emma x


Senior Member
Hiya tbwcf, i have done this, and used the 'static' publishing method (I think!) but am completely new to flash and even if the answer to my Q was shouting me in the face from thedocumentation i wouldnt even be able to pick out the right terminology i dont think.

the index page is just an example of it picking up your version of flash etc.. it doesnt have any reference to this at all i dont think.

what i want to do is put my mp3 player onto my page using swfobject instead of the method given at the top of my first post. i just dont know how to include that flashVar thing..
Is the following something like what you are after?

<script type="text/javascript">
var params = { mp3 : 'mp3_name.mp3' };
swfobject.embedSWF('player_mp3.swf', 'video', 'x', 'y', "9.0.0", '/js/expressinstall.swf', params);
That was wrote off the cuff, but should insert your player_mp3.swf Flash file into a <div> with an ID of video, replacing 'x' and 'y' with width and height of your target div in pixels.

EDIT: Just to clarify, you yourself should enter the values in place of 'x' and 'y' just in case you thought they would be dynamically replaced. They won't be.


Senior Member
hi MCB,

Thanks for putting in to the post :) My problem was actually not to do with either of above, but I got round it by linking all the seperate swfs and flvs together in a different way - through the flash and saving this as the updated swf rather than adding anything to the swfobject file

Thanks to tbwcf and your snippets Ive familiarised myself with swfobject now though, so very helpful still! :) Thankyou both