Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #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?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,851
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Does anybody know how to solve this?
    Can we have a link?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 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!||||

  • #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:
    Attached Thumbnails Attached Thumbnails Swfobject 2 - center flash content problem-untitled-1.jpg  

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 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:

    CaptainB (03-16-2009)

  • #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!


  •  

    Posting Permissions

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