출처: http://www.longtailvideo.com/support/forum/Plugins/18826/Plugins-in-innerHTML

halcyonite

Hi

I am embedding a player in my app along with the sharing plugin.Now I want to make the player appear on the click of a button.To make that happen I have taken an empty <div> and wrote a script to get the embed code in the innerHTML of the <div>.

I got the player but not the plugins.I could'nt make out what the problem is.All of the flash variables are working except the the plugins.

I appreciate if anyone could identify the problem.

My Code:
<html>
<script type="text/javascript">
function Add()
{
document.getElementById("player").innerHTML=embedcode;
}
</script>
<body>
<div id="player"></div>
<input type="button" onclick=" Add()">
</body>
</html>

I am able to get the player with the above code but could not get plugins .

Aug. 04, 2009Zachary Ozer

@halcyonite:

I suspect that it's something to do with your embed code. Could you please post it / a link to it?

Aug. 05, 2009halcyonite

Hi Ozer

This is my embed code.

<embed src="player.swf" width='450' height='450' allowfullscreen='true' allowscriptaccess='always' flashvars='file=filepath&dock=true&plugins=sharing&sharing.code=code&sharing.link=link'/>

Aug. 05, 2009ramsey


var embedcode = '<embed src="player.swf" width="450" height="450" allowfullscreen="true" allowscriptaccess="always" flashvars="file=' + filepath + '&dock=true&plugins=sharing&sharing.code=' + code + '&sharing.link=' + link + '"/>';


Assuming that you have previously defined the JavaScript variables filepath, code, and link.

Aug. 05, 2009halcyonite

Hi ramsey

Firstly I want to say my thanks to ur immediate reaction.
But I am sorry to say that ur code did'nt work.
I am able to render the player along with all the flashvars except the plugins.
My file is in the same directory as the player.
I dont understand why plugins are not rendered .

Aug. 05, 2009ramsey

I'd have to see your testing page before I could offer any more help. Can you post a link?

Aug. 05, 2009Zachary Ozer

@halcyonite:

1.) Which version of the player are you using? Where did you download it from?

2.) Could you use SWFObject (http://www.longtailvideo.com/support/tutorials/Embedding-Flash#swfobject) to embed your player? We find that this often fixes many problems.

AND