A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: [MX04] Centering my Movie in a Browser

  1. #1
    Member
    Join Date
    Jul 2006
    Posts
    44

    [MX04] Centering my Movie in a Browser

    How can I make my flash site centered so that on high resolution screens the movie is in the middle with equal space on the left and right borders but in smaller resolutions it takes up the entire page?
    ex: http://www.grenadegloves.com/

  2. #2
    World Kit Vote Holder Abelius's Avatar
    Join Date
    Feb 2002
    Location
    US
    Posts
    963
    I think that's more of an HTML problem. Place your movie into a table with align set to center and valign set to middle...
    Cordially,
    Abelius
    www.worldkit.com

  3. #3
    Senior Member Big 'Un's Avatar
    Join Date
    Aug 2004
    Location
    NYC
    Posts
    231
    You don't even need a table. You can place it in a div with align set to center:
    <div align="center">
    //your flash code...
    </div>

  4. #4
    Senior Member Big 'Un's Avatar
    Join Date
    Aug 2004
    Location
    NYC
    Posts
    231
    Another kind of cool thing you can do if you choose to use a table is set a CSS style like this:
    Code:
    	body {
    		margin:0;
    		padding:0;
    		background:#ffffff;
    	}
    	table {
    		width:100%;
            height:100%;
    	}
    	td {
            vertical-align:middle;
            text-align:center;
    	}
    That will center your object vertically and horizontally.

  5. #5
    World Kit Vote Holder Abelius's Avatar
    Join Date
    Feb 2002
    Location
    US
    Posts
    963
    All roads lead to Rome, as you can see
    Cordially,
    Abelius
    www.worldkit.com

  6. #6
    Member
    Join Date
    Jul 2006
    Posts
    44
    Quote Originally Posted by Big 'Un
    You don't even need a table. You can place it in a div with align set to center:
    <div align="center">
    //your flash code...
    </div>
    ok so what your saying is I need to put my flash site into another program and do this there? What program should I use?

  7. #7
    Member
    Join Date
    Feb 2005
    Posts
    35
    You don't need a specialised program to work with HTMl...any text editor can be used. that is, notepad, wordpad, etc....just save the file with the .html or .htm extension.

    So if you publish your file from flash and you get a html file, just open up the file and it should look something like this

    <html>
    <head>
    <title>name of flash file</title>
    </head>
    <body>

    ////flash code

    </body>
    </html>

    around the flash code put this tag: <center> and afterwards: </center> thats probably the easiest way to center it horizontally on the page but any of the previous suggestions will work.

  8. #8
    Senior Member Big 'Un's Avatar
    Join Date
    Aug 2004
    Location
    NYC
    Posts
    231
    Also, what Abelius wrote is true...
    if you want to make the Flash seem to "float" in the center of the browser, you can use a table (with or without css) and center the swf vertically and horizontally that way.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center