Enjoy an ad free experience by logging in. Not a member yet?
Register .
03-15-2009, 01:23 PM
PM User |
#1
Regular Coder
Join Date: Jun 2007
Posts: 805
Thanks: 123
Thanked 23 Times in 23 Posts
Swfobject 2 - center flash content problem
Hi guys,
Until resently I used SWFObject 1.5 to display my flash. It worked good, but I decided to try to upgrade to 2.0. But now my flash banner is not centered within the div as it used to be but floats to the left. The banner is rendered to the div "header":
Code:
<script type="text/javascript" src="javascript/simplemarquee.js"></script>
<script type="text/javascript">
var params = {};
params.wmode = "transparent";
swfobject.embedSWF("flash/headermov.swf", "header", "900", "200", "9.0.0", "flash/expressinstall.swf", params);
</script>
CSS:
Code:
#header { margin:0px auto;
width:900px;
height:200px;
text-align:center;
line-height:200px;
}
I tried to add the 'align' param, but that didn't seem to have any effect. Does anybody know how to solve this?
03-15-2009, 02:57 PM
PM User |
#2
Supreme Master coder!
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
Quote:
Does anybody know how to solve this?
Can we have a link?
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
03-15-2009, 03:35 PM
PM User |
#3
Supreme Master coder!
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
Code:
<script type="text/javascript">
var params = {};
params.wmode = "transparent";
var attributes = {};
attributes.style = 'display:block;margin:auto;';
swfobject.embedSWF("flash/headermov.swf", "header", "900", "200", "9.0.0", "flash/expressinstall.swf", params);
</script>
__________________
|||| If you are getting paid to do a job, don't ask for help on it! ||||
03-15-2009, 03:57 PM
PM User |
#4
Regular Coder
Join Date: Jun 2007
Posts: 805
Thanks: 123
Thanked 23 Times in 23 Posts
Aero,
It does not work. Even if I add an 'attributes':
Code:
<script type="text/javascript">
var params = {};
params.wmode = "transparent";
var attributes = {};
attributes.style = 'display:block;margin:auto;';
swfobject.embedSWF("flash/headermov.swf", "header", "900", "200", "9.0.0", "flash/expressinstall.swf", params, attributes );
</script>
Abdura,
It's still on localhost, but here's a screen so you can see what I mean. The banner is slightly pushed to the left instead of being centered:
03-15-2009, 06:36 PM
PM User |
#5
Supreme Master coder!
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
What exactly are you trying to center? Your #header CSS has a width of 900px and a height of 200px. Your flash has the same dimensions. Post the rest of your code as its likely you have more of it.
__________________
|||| If you are getting paid to do a job, don't ask for help on it! ||||
Users who have thanked _Aerospace_Eng_ for this post:
03-16-2009, 08:07 AM
PM User |
#6
Regular Coder
Join Date: Jun 2007
Posts: 805
Thanks: 123
Thanked 23 Times in 23 Posts
Doh. I had messed up the divs so that the header div was outside the main container. Fixed now, thanks!
Jump To Top of Thread
Thread Tools
Rate This Thread
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT +1. The time now is 11:52 PM .
Advertisement
Log in to turn off these ads.