Skip to main content
May 31, 2010
Question

Centralize page - ¿AS3 or HTML?

  • May 31, 2010
  • 1 reply
  • 733 views

Hi. I need to centralize my page and I can't do it with AS3. My whole page is made by Flash but I've reed that is nessesery do it with HTML in idex file. I've seen in a manual this 2 types of code (in body):

div align = "center"

text-align:center;

width:500px;

margin:auto;

I've tryed bouth of them and it dosen't work.

This topic has been closed for replies.

1 reply

Inspiring
May 31, 2010

Do you know a little bit of CSS?

If you do so, you could try something like:

#flash_content {
     width: 750px;
     height: 450px;
     position: absolute;
     top: 50%;
     left: 50%;
     margin-left: -375px;
     margin-top: -225px; }

You set the exact width and height of your flash content, set position to absolute, move the content 50% from top and left and "discount" half of the size of your content to left and top.

June 1, 2010

Actually this css method will center the swf for only  one particular browser window's dimension.

Try swfObject to embed in HTML your swf:

http://code.google.com/p/swfobject/

and here, in point 10., it is explained how to center the swf:

http://code.google.com/p/swfobject/wiki/faq

Inspiring
June 1, 2010

This css is for a div where he should put his swf file using something like swfobject (which I think he's already using).

If he uses this css, when he resizes the page, the swf will automaticaly be "recentered" according to the size of the page.

At least it's working with my website. =/