Setting path of swfobject

1.4k Views Asked by At

I am facing trouble to set the path of swfobject. In my project directory structure I put the swfobject.js and loadmovie.js files in the "Project/src/main/webapp/resources" directory. In same directory I placed the test.swf file. The content of loadmovie.js is:

var swfVersionStr = "10.0.0";
var xiSwfUrlStr = "playerProductInstall.swf";
var flashvars = {};
var params = {};
params.wmode = "transparent";
params.quality = "high";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
var attributes = {};
attributes.id = "test";
attributes.name = "test";
attributes.align = "left";
swfobject.embedSWF("test.swf", "movieDiv", "202", "380", swfVersionStr, xiSwfUrlStr, flashvars, params, attributes);
swfobject.createCSS("#flashContent", "display:block;text-align:left;");

But the test.swf is not loading the web page. If I view the source of the webpage after rendering the swfobject is transforming as :

<object type="application/x-shockwave-flash" id="test" name="test" align="left" data="test.swf" width="202" height="380">
   <param name="wmode" value="transparent">
   <param name="quality" value="high">
   <param name="allowscriptaccess" value="sameDomain">
   <param name="allowfullscreen" value="true">
</object>

And if I replace the data="test.swf" by data="http://localhost/project/resources/test.swf" then swf is visible. Please help. How can I set the path? Thank you

1

There are 1 best solutions below

0
On BEST ANSWER

Use absolute paths:

data="/project/resources/test.swf"