I've tried multiple ways to edit Flash Objects / Embeds via Javascript and it seems to work in everything but IE, so I'm thinking about just throwing IE out the window for this application unless there are older + used version of other browsers that also do not allow you to edit objects. An example of this would be:
document.getElementById(divID).innerHTML = '<object ...><embed ...><\/embed><\/object>';
or in jquery
var params = '<param name="allowFullScreen" value="true" />' +
'<param name="allowScriptAccess" value="always" />' +
'<param name="allowNetworking" value="all" />' +
'<param name="movie" value="player.swf" />' +
$("#objectPlayer").html(params);
If all the rest of the modern browsers and the most used versions of them do support this kind of editing then I'll just scrap IE. And before I get floods of the SWFObject JS Framework, I'm not going to include a huge framework for a browser that I do not believe is going to contain my demographic.
JSFiddle
Here's a link to a JSFiddle I created. It works in all browsers but IE8
I believe the <param>
part of your code is for <object>
.
You have to pass the name/value pairs for embed
too.
$("#objectPlayer embed").attr({
"src": "fileName.swf",
"name": "fileName",
"allowFullScreen": "true",
"width": 200,
"height": 100,
"type": "application/x-shockwave-flash"
//and so on...
});
But I would use SWFObject anyway, it is the industry standard, it's quite robust and it is the best way of embedding flash on the website.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With