0

In chrome the swf would not load until unless there is a click made on the div,what am i doing wrong

 var html += '<div align="center"><OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"  id="myMovieName">';

  html += ' <PARAM NAME="movie" VALUE="/media/cam.swf" /> <PARAM NAME="quality" VALUE="high" /> <PARAM NAME="bgcolor" VALUE="#FFFFFF" /> <EMBED href="/media/players/camera.swf" src="/media/players/camera.swf" quality=high bgcolor=#FFFFFF NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash"> </EMBED> </OBJECT></div>';

 $("#contents").append(html);

1 Answer 1

1

The preferred way of loading swfs with JavaScript would be to use swfobject, rather than just a plain string and jQuery. There are just way too many issues that arise when doing it the string-way.

An example:

<!-- Include swfobject -->
<script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>

<!-- Put this somewhere on your page -->
<div id="place_to_put_the_swf">
   The content inside this div will be seen if 
   the user doesn't have flash installed.
   Put an image, error message or whatever here.
</div>

<!-- This script with replace the div above with the following swf.
     The parameters are filename, id of the div, width, height and flash version. -->
<script>
  swfobject.embedSWF("file.swf", "place_to_put_the_swf", 400, 300, "7");
</script>

Of course you can use jQuery to render the div and then run the embedSWF-function, all in your JavaScript, if you prefer.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.