PDA

Click to See Complete Forum and Search --> : help centering swf object


Gravity
03-14-2008, 05:15 PM
I'm struggling with how to make my flash content centered on the page vertically. I know there is probably an easy solution that any non-web-newbie could give me. Any suggestions?

check it at: www.gravitystl.com (http://www.gravitystl.com)

John G
03-14-2008, 05:22 PM
you can do it in flash, but I don't think you can do a page valign with html maybe with javascript?

Rooster
03-14-2008, 06:35 PM
Do it in .js or in CSS. Tell the body to v-align everything in it.

DesignVHL
03-14-2008, 07:08 PM
You can probably just use the <style></style> tag right in your header, since you probably don't have much to define and your site will only be one page (assuming it's ALL flash). If it were a large site, definitely go with the external css...but probably not necessary here for such small definitions.

#mymovie {
vertical-align:middle;
}

OR you can have it be at the top in your div and just set a top padding of 150px if you just wanted to bring it down from the top.

Gravity
03-14-2008, 07:10 PM
I relocated the css body tag to the head area and added a vertical-align: middle; to it... that didn't work for some reason. Been trying to avoid any javascript, but will delve into it if necesssary. Guess it's not as simple as I thought. I don't know if I should feel better or worse...

Rooster
03-14-2008, 08:12 PM
Keep your css where it is at. In the <head> create another css tag and do an #mymovie and try to vertical align it middle as VHL said. If that does not work, try to add the vertical-align:middle to the #flashcontent.

katgal
03-14-2008, 08:40 PM
I fixed it for you. Just view source and copy the code.

http://clients.bkbdesigngroup.com/gravity.htm

DesignVHL
03-14-2008, 08:45 PM
eeehhhh thats shoooting to the right in firefox...and still aligned to the top.

this is interesting tho..would like to see this work for such a simple thing!

katgal
03-14-2008, 08:56 PM
I use firefox as my main browser, and it's centered for me in firefox, ie7 and ie6.

DesignVHL
03-14-2008, 09:00 PM
hmm i just looked again, and yep it IS now vertically aligned...but it looks like its still off to the right - not center aligned horizontally..unless the actual FLASH file is just making it seem off center - but actually is.

EDIT: definitely not center aligned horiz. right now....weird.

katgal
03-14-2008, 09:08 PM
I see what you mean, but only when I make my browser window smaller. Let me see if I can figure that out.

katgal
03-14-2008, 09:16 PM
ok, all better now. one random line of css was causing the problemo.

DesignVHL
03-14-2008, 09:18 PM
lol usually the case! was jokin around in another forum on how easy it can be to miss something as simple as a ; to throw everything off! :p

Gravity
03-17-2008, 08:48 PM
Fantastic. Thanks so much VHL and katgal... you have my undying gratitude!!!!!!!