PDA

View Full Version : html code not centering my swf movie in the browser


Studiomedia7
03-26-2008, 12:14 AM
hello i am trying to center my flash movie in the browser, but the browser instead places the swf on the top of the browser... any ideas how can i fix this? i know it must be simple, but i just cant figure this out... here have a look at my html code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Cyprus Airports</title>
<meta name="description" content=" media, advertising">

<meta name="keywords" content=" airport, Advertising,">


</head>
<body bgcolor="#000000">

<div style="width:300px; height:197px; margin:0 auto;"
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="300" height="197" id="index" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="index.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" /><embed src="index.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="300" height="197" name="index" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</div>
</body>
</html>
thanks for your time:cool:

yell0wdart
03-26-2008, 05:09 AM
Have you tried setting margin-left and margin-right of your div container to auto? I see you have margin set to auto, and technically that should do the same thing, but I've found declaring left and right separately helps.

jsebrech
03-26-2008, 08:59 AM
If you google for "vertically centering css" you'll find a lot of links that explain how to do it.

Studiomedia7
03-26-2008, 10:47 AM
Hello and thank you for your answers....i didnt manage to solve the problem i tried setting the margin to left and right instead of auto, but the swf moved completely left of the browser and then completely right...
Is there a simple way to do this? Would it be normal for html to place my swf in the middle when i say align="middle">

Does html read vertical center? how do i do that? dont know much about html i am still learning so pls be patient...:)

Chris_Stevens
03-26-2008, 07:20 PM
http://www.jakpsatweb.cz/css/css-vertical-center-solution.html
^^ A very simple, and validating solution to the problem! Note the ability to reflect any window size!

Also you should use a Javascript based flash embedding to avoid the "click here to activate" problem in IE.

yell0wdart
03-26-2008, 07:25 PM
Actually, that's not really what I was getting at. I probably should have included a code example. You set your margin-left and margin-right to auto.


<style>
#main
{
margin-left: auto;
margin-right: auto;
}
</style>


/edit

Ah, you're talking about vertically aligning your movie. I must have misread. Give Chris' solution a whirl.

Another method might be to put the movie in a table (*gasp*, yea, I said the "t" word). That way you could set the height of the to 100%, and the vertical alignment of the cell to middle.