Forum Moderators: open
function createFlashLayer2 (name,flashID,swf,xpos, ypos) {var layer = document.createElement ('div')
var tobject = document.createElement('object')
var param1 = document.createElement('param')
var param2 = document.createElement('param')
var param3 = document.createElement('param')
var tembed = document.createElement('embed');
layer.setAttribute ('id', name);
layer.setAttribute ('style', 'position:absolute; left:'+xpos+';top:'+ypos);
tobject.setAttribute('classid','clsid:27CDB6E-AE6D-11cf-96B8-444553540000');
tobject.setAttribute('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0');
tobject.setAttribute ('id', flashID);
param1.setAttribute('movie',swf);
param2.setAttribute('quality','high');
param3.setAttribute('wmode','transparent');
tembed.setAttribute('src',swf);
tembed.setAttribute('width','350');
tembed.setAttribute('height','300');
tembed.setAttribute('quality','high');
tembed.setAttribute('pluginspage','http://www.macromedia.com/go/getflashplayer/');
tembed.setAttribute('type','application/x-shockwave-flash');
tembed.setAttribute('wmode','transparent');
tembed.setAttribute ('name', flashID);
onload = function ()
{
document.body.appendChild (layer);
document.getElementById(name).appendChild(tobject);
document.getElementById(flashID).appendChild(param1);
document.getElementById(flashID).appendChild(param2);
document.getElementById(flashID).appendChild(param3);
document.getElementById(flashID).appendChild(tembed);
}
Obj = document.createElement("embed","wmode");
Obj.setAttribute("src",swf);
Obj.setAttribute("width",250);
Obj.setAttribute("height",300);
Obj.setAttribute("wmode", "transparent");
Obj.setAttribute ("id",flashID);
layer.appendChild(Obj);
So I guess I kind of created a um...embed tag and wmode in one...or sorta. I really don't understand it myself but at least the damn thing works! I can even talk to the flash movie with the flashID name through javascript and send commands to javascript with getURL ("javascript myfunction()") in actionscript. Plus this is all loaded in the head of the document which means just one line of code to load the source and I'm playing with layers with transparent Flash now in both IE and Netscape...YEA!