PDA

View Full Version : Centering a Flash Object


wwswimming
04-09-2010, 01:32 PM
I am trying to center an animation that I've composited using Flash.

This is my code, pasted below.

I've taken the HTML generated by FLash CS4 and spliced it with HTML generated by a Mozilla web editing program named Seamonkey. (Seamonkey is descended from Netscape 4.79, my favorite Netscape rev.)

Also, in Publish Settings, I look in the HTML tab, I set it for "Center Flash Content".

Anyway, I just want to center a Flash object (from left to right), in the center of the page. But it's not coming out centered.

What are the proper HTML tags for centering a flash object ?

In this case the *.swf is named "test_MastHead__.swf".


<div style="text-align: center;">
<center><noscript> <object
classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0"
id="test_MastHead__" align="middle" height="111" width="444"><param
name="allowScriptAccess" value="sameDomain"> <param
name="allowFullScreen" value="false"> <param name="movie"
value="test_MastHead__.swf"><param name="quality"
value="high"><param name="bgcolor" value="#ffffff">
<embed src="test_MastHead__.swf" quality="high" bgcolor="#ffffff"
name="test_MastHead__" allowscriptaccess="sameDomain"
allowfullscreen="false" type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer" align="middle"
height="111" width="444"> </object></noscript>
<br>
<br>
test
test
</center>
</div>

Ian Jones
04-10-2010, 11:08 PM
Well, you seems to be writing obsolete HTML 4.01 rather than XHTML (So I made a couple of changes, but didnt even touch the potential problems with the Flash embed (that's a more complex issue), so you should probably read up more about that at www.w3schools.com

In the mean time, the way to achieve it is with an additional Div container wrapped around everything. You give this Div container 100% width of the browser (or whatever area you want to center within) then you place another div within this to hold your centered content. The inner Div then needs to have its width set and then the trick is to give it 'auto' margins on the left and right. It then sits in the horizontal middle of the container Div.

<div id="container" style="width: 100%">
<div id="swf" style="width:444px; height:111px; margin: 0 auto 0 auto;">
<noscript> <object
classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0"
id="test_MastHead__" align="middle" height="111" width="444"><param
name="allowScriptAccess" value="sameDomain"> <param
name="allowFullScreen" value="false"> <param name="movie"
value="test_MastHead__.swf"><param name="quality"
value="high"><param name="bgcolor" value="#ffffff">
<embed src="test_MastHead__.swf" quality="high" bgcolor="#ffffff"
name="test_MastHead__" allowscriptaccess="sameDomain"
allowfullscreen="false" type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer" align="middle"
height="111" width="444"> </object></noscript>
<br />
<br />
test
test
</div>
</div>

wwswimming
04-11-2010, 01:15 PM
thank you !

CGTalk Moderation
04-11-2010, 01:15 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.