| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
Resident Cheese Expert
Join Date: Aug 2006
Location: South Wales
Posts: 1,090
|
Centering Flash in a Browser
I'm trying to get my Flash file centered within my browser. I've searched all over Google, and come up with lots of different methods of how to do this, but none seem to work for me. I've tried using CSS, putting the Flash inside a table, and even a deprecated <center> tag. I'm using some ActionScript to repeat a pattern to 100% of the browser, and in order to implement this, I've had to make a few alterations to the HTML Publish settings. Would this be whats causing the problem? (Oh, and the effect I'm after is exactly the same as top_buzz's last showcase item, the New Years Eve nightclub site!) Cheers |
|
|
|
|
|
#4 (permalink) |
|
big paw
|
I like your avatar pagey ... Now I would go about centering that flash object vertically by giving the html and body element heights of 100% then creating a table of width 100% and height 100% with only one <td> valign that <td> middle and align it center and presto you have a flash object that will always be in the center of the page regardless of the page width or height. |
|
|
|
#5 (permalink) |
|
Resident Cheese Expert
Join Date: Aug 2006
Location: South Wales
Posts: 1,090
|
Ok, so I've now got this as my CSS: HTML Code:
And this for my content: HTML Code:
But its still not centering.... ![]() |
|
|
|
#6 (permalink) |
|
For all your goober needs
Join Date: Dec 2004
Location: Coventry, UK
Posts: 1,547
|
no tr?? Time is really the only capital that any human being has, and the one thing that he can’t afford to lose. - Thomas Edison
prem ghinde |
|
|
|
#9 (permalink) |
|
shiro
Join Date: Aug 2007
Location: Yokohama, Japan
Posts: 3,066
|
Try this: Code:
|
|
|
|
#10 (permalink) |
|
big paw
|
This would be my code for aligning a picture in the center/middle of the page. Code:
|
|
|
|
#11 (permalink) |
|
Resident Cheese Expert
Join Date: Aug 2006
Location: South Wales
Posts: 1,090
|
Seeing as I'm starting to lose the will to live, I'll show you exactly the code I am using...This options doesn't work, and I also tried using a table (like one of you guys mentioned) and that didn't work either T This is just the code that Flash CS3 outputs after being published: HTML Code:
|
|
|
|
#12 (permalink) |
|
big paw
|
it works
it should work with the div too but here you go here's my code Code:
*notice where I declared the height for the html container |
|
|
|
#13 (permalink) |
|
Senior Member
Join Date: Nov 2007
Posts: 103
|
This is the code I used to get mine centered. I had to use the DIV and table to get it where I wanted. Code:
|
|
|
|
#14 (permalink) |
|
Resident Cheese Expert
Join Date: Aug 2006
Location: South Wales
Posts: 1,090
|
Thanks for your help, sadly, it still didn't work I'm not sure if something within Flash is ruining it. When I added your code my background (which was covering 100% of the browser background) was missing on the right third of my screen, so it obviously did something! Anyway, if anybody knows what I might be doing wrong, I'd be extremely grateful. Thanks |
|
|
|
#15 (permalink) |
|
Semantics, yay.
Join Date: Nov 2005
Location: Salem, Massachusetts
Posts: 1,146
|
HTML: <div id="flashContainer"> all your flash stuffs here. </div> CSS: #flashContainer { width: 500px; /* Change this number to the real width of your movie */ height: 800px; /* Change this number to the real height of your movie */ position: relative; left: 50%; top: 50%; margin-left: -250px; /* Change this number to half the real width of your movie */ margin-top: -400px; /* Change this number to half the real height of your movie */ } |
|
|
|
#16 (permalink) |
|
Resident Cheese Expert
Join Date: Aug 2006
Location: South Wales
Posts: 1,090
|
Thanks for all the suggestions. I'm sure in most cases they would all work perfectly, but unfortunately, I'm thinking that it must be something to do with my publish settings, or my ActionScript. In a last ditch attempt to get this sorted, I'll bare the soul of my whole project, and see if anybody can see the problem. ![]() I had to change some of the default settings on the publish section above in order to make the background repeat 100% thorughout the browser. ![]() The HTML code, complete with Herks centering technique. HTML Code:
My ActionScript in order to resize the browser without resizing the content, and to make the backgrounf image repeat. HTML Code:
Thats all I can think of for now. Any help on this is appreciated as always. |
|
|
|
#20 (permalink) | |
|
Resident Cheese Expert
Join Date: Aug 2006
Location: South Wales
Posts: 1,090
|
Quote:
Whenever I try that, the repeated background centres itself, and doesn't stretch over the left side of the browser. Thanks though. |
|
|
![]() |