Write swfobject without container

38 views
Skip to first unread message

regsnerven

unread,
Nov 21, 2009, 11:39:18 AM11/21/09
to SWFObject
Hello guys,

i want to print the swfObject directly where i call the function and
not in a div-container. How can i do that?

Gr33tZ
Rn

Aran

unread,
Nov 23, 2009, 1:55:33 AM11/23/09
to SWFObject
What you you mean "print"?

The basic principal is that SWFObject will write an <object>
definition for your swf to a certain DOM element after Flash player /
JS detection has taken place. If you need to, you can dynamically
create a DOM element and then write to that...

I am not really understanding what you are wanting / can't achieve
with the SWFObject API, so perhaps you can explain yourself a bit
more?


Aran

On Nov 22, 3:39 am, regsnerven <761e7cf11...@5aeb8cfcead0.anonbox.net>
wrote:

regsnerven

unread,
Nov 23, 2009, 1:13:31 PM11/23/09
to SWFObject
Hey,

i want to write the object-tags and stuff without giving a container
for it.
This is what you normally have to write to use SWFObject:

<div id='ad728'> </div>
<script type="text/javascript">
var so = new SWFObject("swfFile.swf", "728x90", "728", "90", "8",
"#000000");
so.addParam("quality", "high");
so.addParam("base", "../bloodbowl/");
so.addParam("wmode", "transparent");
so.addVariable("clickTAG", "http://www.bloodbowl-game.com");
so.write('ad728');
</script>

So the SWFObject will be written into the DIV with the id 'ad728'.
But i want to use it like this:

<script type="text/javascript">
var so = new SWFObject("swfFile.swf", "728x90", "728", "90", "8",
"#000000");
so.addParam("quality", "high");
so.addParam("base", "../bloodbowl/");
so.addParam("wmode", "transparent");
so.addVariable("clickTAG", "http://www.bloodbowl-game.com");
so.write();
</script>

So i dont need to set a container for the SWFObject and can directly
write the content where i call the function.

I hope you unterstand what i mean. I am not that good in english..

Gr33tZ
Rn

Sam Sherlock

unread,
Nov 23, 2009, 2:49:01 PM11/23/09
to swfo...@googlegroups.com
I think your best is to use static objects of swfobject 2.x (the flash instance will be in the page using nested objects & ie conditionals)

generate the code using the online generator 

make sure that your using the 2.x version of the swfobject script (the syntax you have posted is 1.x)

If however your can't accomplish your aims with swfobject static / dynamic please explain what your hoping to achieve

hth - S




2009/11/23 regsnerven <761e7c...@5aeb8cfcead0.anonbox.net>
--

You received this message because you are subscribed to the Google Groups "SWFObject" group.
To post to this group, send email to swfo...@googlegroups.com.
To unsubscribe from this group, send email to swfobject+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/swfobject?hl=.



regsnerven

unread,
Nov 23, 2009, 5:48:40 PM11/23/09
to SWFObject
An company gave me that code and i need to referer it to my ad
company.
And i think a div-Tag would ruin my design if the ad is bounded in my
site.

Why isn't it possible to just WRITE the object-tags and stuff instead
of putting it in the INNERHTML of a container?


On 23 Nov., 20:49, Sam Sherlock <sam.sherl...@gmail.com> wrote:
> I think your best is to use static objects of swfobject 2.x (the flash
> instance will be in the page using nested objects & ie conditionals)
>
> generate the code using the online generatorhttp://www.bobbyvandersluis.com/swfobject/generator/index.html
>
> make sure that your using the 2.x version of the swfobject script (the
> syntax you have posted is 1.x)
>
> If however your can't accomplish your aims with swfobject static / dynamic
> please explain what your hoping to achieve
>
> hth - S
>
> 2009/11/23 regsnerven <761e7cf11...@5aeb8cfcead0.anonbox.net>
> > swfobject+...@googlegroups.com<swfobject%2Bunsu...@googlegroups.com>
> > .

Sam Sherlock

unread,
Nov 23, 2009, 7:09:40 PM11/23/09
to swfo...@googlegroups.com
I don't think you'll have troubles with this - the presentation can be controlled via css

see points 11 && 15


Why isn't it possible to just WRITE the object-tags and stuff instead of putting it in the INNERHTML of a container?

1) because swfobject waits until the dom is ready with embedSWF - it replaces alt content in the chosen element
2) just writing the tags - before dom is ready causes issues with some browsers

Aran or Kyle may well explain that better than me - or indeed correct me :)

- S


2009/11/23 regsnerven <761e7c...@5aeb8cfcead0.anonbox.net>
An company gave me that code and i need to referer it to my ad
To unsubscribe from this group, send email to swfobject+...@googlegroups.com.

Aran Rhee

unread,
Nov 23, 2009, 7:14:31 PM11/23/09
to swfo...@googlegroups.com
Why would having a div tag which is specific for placement of your ads ruin your design?  Every site which runs ads defines certain real estate on the page for certain ad sizes etc. How were you going to layout your page / decide WHERE you ads are going?

Anyhow, using your orginal SWFObject 1.x notation you could do it like the below. I am really unsure WHY you want to do it like this, but hey, it's your site...



<html>
<head>
<script type="text/javascript" src="swfobject.js"></script>
</head>
<body>

<script type="text/javascript">
var str = "<div id='ad728'></div>" + 
"<script type='text/javascript'>" +
"var so = new SWFObject('swfFile.sw', '728x90', '728', '90', '8', '#000000');" +
"so.addParam('quality', 'high');" +
"so.addParam('base', '../bloodbowl/');" + 
"so.addParam('wmode', 'transparent');" + 
"so.addVariable('clickTAG', 'http://www.bloodbowl-game.com');" + 
"so.write('ad728');" +
"<\/sc" + "ript>";
document.write(str);
</script>
</body>
</html>


Aran

regsnerven

unread,
Nov 24, 2009, 1:03:56 PM11/24/09
to SWFObject
Okay thanks. Problem solved ;)
Reply all
Reply to author
Forward
0 new messages