/    Sign up×
Community /Pin to ProfileBookmark

How to get this to work in IE????

Man, I will pay someone to help me out with this puzzle. I’m just trying to create a transparent Flash object on a layer when the document loads. This works perfectly fine in Netscape, but in IE it gets errors. The only way I can get it in IE is with only using the embed tag (backwards??!) and then I can’t access it by name or make it transparent. Here is the function that works fine in Netscape:

[code]
function createFlashLayer (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’, “something”);
tobject.setAttribute (’embed’, ’embed’);

param1.setAttribute (‘name’, ‘movie’);
param1.setAttribute(‘value’, swf);
param2.setAttribute(‘name’, ‘quality’);
param2.setAttribute (‘value’, ‘high’);
param3.setAttribute(‘name’, ‘wmode’);
param3.setAttribute (‘value’,’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);

document.body.appendChild (layer);

document.getElementById(name).appendChild(tobject);
tobject.appendChild(param1);
tobject.appendChild(param2);
tobject.appendChild(param3);
tobject.appendChild(tembed);
}
[/code]

I call it this way:

[code]
onload = function () {

createFlashLayer(‘explodeLayer’, ‘explosion’, ‘explosion.swf’, 0,0);
createFlashLayer(‘cannonLayer’,’cannon’,’cannonshoot2.swf’,0,0);

}
[/code]

Is this even possible!! I have been trying things for days now and have gotten so close, but still doesn’t work right in IE.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@oleragMar 04.2004 — For IE, I believe you'll be working with "iframes". Recently,

[b]fredmv[/b] provided this [URL=http://www.dotnetjunkies.com/WebLog/jking/archive/2003/07/21/488.aspx]link[/URL] for Flash integration with IE.

And as he is now the [color="green"]new[/color] moderator, whose to argue with that.
Copy linkTweet thisAlerts:
@ShawnauthorMar 04.2004 — Well, thanks man, however for my needs I need to use a <div> just because of the weirdness of my project. Anyway....believe it or not, I found a solution. And it makes about no sense to me why this is how it must be done, because the prior example is the proper way to code it. Just IE mess. IE needs to have the flash object created with the <embed> tag and will not work with the IE specific <object> tag and have no idea why. Anyway, here's what I coded to enable IE to create flash at document load with a transparency param as well!

<i>
</i>function createFlashLayerIE3 (name,flashID,swf,xpos,ypos,width,height){
var layer = document.createElement("div");
layer.setAttribute("id",name);
layer.style.textAlign="center";
layer.style.position="absolute";
layer.style.top=xpos;
layer.style.left=ypos;
layer.setAttribute("style", "width:50%; text-align:center; position:absolute; top:20px; left:30px;");
document.body.appendChild(layer);

embed = document.createElement("embed","wmode");
embed.setAttribute("src",swf);
embed.setAttribute("width",width);
embed.setAttribute("height",height);
embed.setAttribute("wmode", "transparent");
embed.setAttribute ("id",flashID);
layer.appendChild(embed);
} <br/>


As you see by the function name, I have been writing quite a few functions the last few days to try and accomplish this!
×

Success!

Help @Shawn spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.8,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...