Issues loading SWF with External SWF Files - using SWFObject and ExternalInterface
Posted
by wdense51
on Stack Overflow
See other posts from Stack Overflow
or by wdense51
Published on 2010-04-06T01:12:37Z
Indexed on
2010/04/07
2:33 UTC
Read the original article
Hit count: 425
swfobject
|externalinterface
I'm having issues with loading a SWF that references external SWF files...
The main SWF loads fine if the HTML file is in the same folder as all the SWFs using the following code:
<script type="text/javascript" src="../js/swfobject.js"></script>
<script type="text/javascript">
var flashvars = {};
var params = { allowScriptAccess: "always" };
params.quality = "high";
params.wmode = "transparent";
var attributes = {id:"IDofSWF", name:"IDofSWF"};
swfobject.embedSWF("event_so_js.swf", "flashContent", "700", "400", "7.0.0", false, flashvars, params, attributes);</script>
</head>
<body>
<div id="flashContent"> <object data="event_so_js.swf"
name="IDofSWF" id="IDofSWF" type="application/x-shockwave-flash"
width="700" height="400"></object></div>
But as soon as I move the HTML file out of that folder to the root folder and update the links, it doesn't load correctly - it seems that it's having trouble with the external SWF files. I did have it successfully load one of the external SWF files directly, but it's having trouble with the main SWF. All of the SWF files are in the same folder, so I don't know why it's having issues. Here's the code for the HTML file when it's in the root folder:
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">
var flashvars = {};
var params = { allowScriptAccess: "always" };
params.quality = "high";
params.wmode = "transparent";
var attributes = {id:"IDofSWF", name:"IDofSWF"};
swfobject.embedSWF("folio/event_so_js.swf", "flashContent", "700", "400", "9.0.0", false, flashvars, params, attributes);</script>
</head>
<body>
<div id="flashContent"> <object data="folio/event_so_js.swf"
name="IDofSWF" id="IDofSWF" type="application/x-shockwave-flash"
width="700" height="400"></object></div>
There is also a link on the page that calls a function in the actionscript using ExternalInterface, so it could be that causing the issues. The code for the link is:
<a href="#" onclick="document.getElementById('IDofSWF').clicky()">
Any help would be awesome, because it's really confusing me.
© Stack Overflow or respective owner