how do I get 2 different flash objects working on the same page?

thanks jb

1 answer

BPartch 342
This was chosen as the best answer

I'm not sure how you are going about embedding the .swf(s) but I recommend using swfObject to do it. This relies on JavaScript, though I'm assuming anyone that has flash installed probably also has JS enabled:

First you need to download swfObject from here:

The top one is the script (necessary files), the second 2 are ways of generating the necessary elements/code required to do this, these are optional. Feel free to check them out but you will not really need them when I am done here. :)

After you have downloaded the swfObject.js file you will need to unzip the contents and include it in the head of your .html file(s)

<script type="text/javascript" src="path_to_swfobject.js"></script>

Then you will need to create the element(s) you want to hold the flash:

<div id="myContent">
 <p>Alternative content</p>

<div id="myContent2">
 <p>Alternative content</p>

These id's can be changed to whatever you want. Just make sure they have different names.

Then finally in the head section again you need to call the .swf files.

  <script type="text/javascript">
    var flashvars = {};
    var params = {}; = "false";
    params.wmode = "transparent";
    var attributes = {};
    swfobject.embedSWF("path_to_file.swf", "myContent", "300", "120", "9.0.0",".path_to_expressInstall.swf", flashvars, params, attributes);
    swfobject.embedSWF("path_to_file.swf", "myContent2", "300", "120", "9.0.0","path_to_expressInstall.swf", flashvars, params, attributes);

The flashvars, params at the top are also optional (see link below for a complete list and how to use them beyond what the 2 I have added do)The expressinstall is a means for users that do not have flash to install it while still at your site. There is a expressinstall.swf file included.

More info here:

Answered over 9 years ago by BPartch