[SWFObject] Center flash movie in html?

Geoff Stearns geoff at deconcept.com
Mon Sep 25 16:52:05 PDT 2006


well if your movie is full screen you can use the fullpage.html  
example that comes with swfobject...

if it's not full screen, there's a number of ways you can do it..

the usual way is to use absolute positioning and set the top and left  
position of your div to 50%, then set the top and left margins to  
-1/2 of the pixel size of your flash movie/div size.





On Sep 25, 2006, at 6:39 PM, Mike Kaplan wrote:

> I was hoping to do it with CSS - does anybody have an example of that?
>
> Thanks for your help Jud!
>
>
> On Sep 25, 2006, at 4:31 PM, Jud Holliday wrote:
>
>> Here's an example which will center the content both horizontally and
>> vertically. You could probably strip out some of the table attributes
>> and use css for those too, but I just had this handy.
>>
>> -Jud
>>
>>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>> <html xmlns="http://www.w3.org/1999/xhtml">
>> <head>
>> 	<title>Title here</title>
>> 	<script type="text/javascript" src="js/swfobject.js"></script>
>> 	
>> <style type="text/css">
>>
>> html { height: 100%; }
>> body {
>> 	height: 100%;
>> 	margin: 0;	
>> }
>>
>> </style>
>> 	
>> </head>
>> <body>
>>
>> 	<table cellpadding="0" cellspacing="0" border="0" height="100%"
>> width="100%">
>> 	<tr>
>> 		<td align="center">
>> 			<div id="flashcontent">
>> 				Alternate content here.
>> 			</div>
>> 			<script type="text/javascript">
>> 				// <![CDATA[
>> 				var so = new
>> SWFObject("yourfilename.swf", "main", "500", "400", "8", "#FFFFFF",
>> false);
>> 				so.write("flashcontent");
>> 				// ]]>
>> 			</script>
>> 		</td>
>> 	</tr>
>> 	</table>
>>
>> </body>
>> </html>
>>
>> -----Original Message-----
>> From: swfobject-bounces at lists.deconcept.com
>> [mailto:swfobject-bounces at lists.deconcept.com] On Behalf Of Mike
>> Kaplan
>> Sent: Monday, September 25, 2006 2:23 PM
>> To: swfobject at lists.deconcept.com
>> Subject: [{SPAM?}] - [SWFObject] Center flash movie in html? -  
>> Sending
>> mail server found on relays.ordb.org
>>
>> How do I go about centering my Flash movie in the html while using
>> the SWFObject? I would like to contain it in a div tag if possible.
>> Thanks!
>> _______________________________________________
>> SWFObject mailing list
>> SWFObject at lists.deconcept.com
>> http://lists.deconcept.com/listinfo.cgi/swfobject-deconcept.com
>> _______________________________________________
>> SWFObject mailing list
>> SWFObject at lists.deconcept.com
>> http://lists.deconcept.com/listinfo.cgi/swfobject-deconcept.com
>
> _______________________________________________
> SWFObject mailing list
> SWFObject at lists.deconcept.com
> http://lists.deconcept.com/listinfo.cgi/swfobject-deconcept.com




More information about the Swfobject mailing list