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 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    9
    Thanks
    4
    Thanked 0 Times in 0 Posts

    center aligned and absolute positioned swf IE6 issue

    okay, i have a flash title, absolutely positioned the following way:

    Code:
    .flash	{
    	position:absolute;
    	top:0px;
    	margin-left:auto;
    	margin-right:auto;
    	right:0px;
    	left:0px;
    	border:0px;
    	z-index:98;
    	text-align:center;
    }
    Code:
    <div class="flash" align="center"><script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
      <script type="text/javascript">
    AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','864','height','280','src','swf/logo','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','wmode','transparent','movie','swf/logo' ); //end AC code
    </script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="864" height="280">
        <param name="movie" value="swf/logo.swf" />
        <param name="quality" value="high" />
        <param name="wmode" value="transparent" />
        <embed src="swf/logo.swf" width="864" height="280" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="transparent"></embed>
      </object>
    </noscript></div>
    It aligns perfectly to the center in IE7 and FF, but in IE6, the left edge of the swf, sticks flush to the left edge of the browser window.

    Getting it to center was a headache enough, and stupid me waits til the end to test in IE6. I have tried everything i can think of and it doesnt move in 6. Anybody know what I could change to get it aligned?

  • #2
    Regular Coder Doctor_Varney's Avatar
    Join Date
    Mar 2008
    Location
    Midlands, UK
    Posts
    649
    Thanks
    45
    Thanked 29 Times in 28 Posts
    Try it like this:

    Code:
    .flash {
    	position:absolute;
            left:50%;
            margin-left:-432px (or as shorthand: margin:0 0 0 -432px;)
            z-index:98;
            text-align:center
    }
    Now that is, presuming your area for the Flash is going to be 864px wide. Whatever the size, halve it and apply that number as a negative left margin. This should send your element absolute centre-screen. I've had all sorts of trouble with auto margins (btw, it's actually 0 auto) but I've found this simpler and more reliable.

    Hope this helps. Let us know how you get on with it.

    Last edited by Doctor_Varney; 11-19-2008 at 07:15 AM.
    Definition: Computer rage is a heightened physiological response with associated feelings of anger and frustration[1] resulting from using a computer or other complex electronic device. It may result in the physical assault of the computer or similar item.[2] Computer use often leads to verbal abuse and occasionally physical violence towards the object.[3] Computer rage may be caused by distress due to a hardware or software problem which the enraged person is unable to correct.

  • Users who have thanked Doctor_Varney for this post:

    RYann (11-19-2008)

  • #3
    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
    You'd need to use the Deadcentre approach for this. I think it's possible to effectively apply left and right properties together.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #4
    Regular Coder Doctor_Varney's Avatar
    Join Date
    Mar 2008
    Location
    Midlands, UK
    Posts
    649
    Thanks
    45
    Thanked 29 Times in 28 Posts
    Also...

    I don't think you need this:
    <div class="flash" align="center">

    The stylesheet should take care of presentation. Use HTML elements as a raw building blocks and let the CSS do the styling.

    Definition: Computer rage is a heightened physiological response with associated feelings of anger and frustration[1] resulting from using a computer or other complex electronic device. It may result in the physical assault of the computer or similar item.[2] Computer use often leads to verbal abuse and occasionally physical violence towards the object.[3] Computer rage may be caused by distress due to a hardware or software problem which the enraged person is unable to correct.

  • #5
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    9
    Thanks
    4
    Thanked 0 Times in 0 Posts
    thats great thanks a lot. you saved me hours of stress. haha.

    and your right, i dont need to align the div, but i just wanted to be sure, ive taken it out now and its fine.

    thanks again


  •  

    Posting Permissions

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