A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: actually a html question..

  1. #1
    ReMember gobbles's Avatar
    Join Date
    Nov 2002
    Location
    Denmark
    Posts
    983

    actually a html question..

    Hi
    I was wondering..knowing nothing about html...
    the file that flash generates, how would I center my swf to the exact middle of the screen, and have a jpg picture be the background of the entire html page..

    thanks
    http://www.rickigregersen.com ...finally a blog!

    Your damned if you do...but your particually damned if you don´t

  2. #2
    did0bib chero's Avatar
    Join Date
    Jun 2004
    Location
    in a bar, under the sea
    Posts
    751
    You can set the background using CSS:
    http://www.w3schools.com/css/css_background.asp

  3. #3
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    You can make the movie appear in the centre of the page like this,

    first add the following just before the opening <object> tag in your page,

    <div id="movie">

    and then add,

    </div>

    just after the closing </object> tag.

    now between the opening <head> and closing </head> tags in your page add, (the following assumes a movie 500 pixels wide and 400 pixels high)

    Code:
    <style type="text/css">
    #movie {
      position: absolute;
      left: 50%; top: 50%;
      margin: -200px 0 0 -250px; padding: 0;
    }
    </style>
    the

    position: absolute;
    left: 50%; top: 50%;

    positions your movie so that its top left corner is centred on the page,

    the

    margin: -200px 0 0 -250px;

    part nudges the movie up (by 200 pixels) and left (by 250 pixels) so that the centre of the movie is centred on the page.

    if your movie is not 400 pixels high you would need to change -200px to be

    -(half the height of your movie)px

    and if it isn't 500 pixels wide you would need to change the -250px to be

    -(half the width of your movie)px

  4. #4
    ReMember gobbles's Avatar
    Join Date
    Nov 2002
    Location
    Denmark
    Posts
    983
    Thanks both of you..
    So I have to some how splice the code the both of you have provided, I'll give it a try..

    Thanks again
    http://www.rickigregersen.com ...finally a blog!

    Your damned if you do...but your particually damned if you don´t

  5. #5
    did0bib chero's Avatar
    Join Date
    Jun 2004
    Location
    in a bar, under the sea
    Posts
    751
    No problem, gobbles.

    Thanx catbert, I thought there might be a way to do this with CSS, but couldn't figure it out.

  6. #6
    ReMember gobbles's Avatar
    Join Date
    Nov 2002
    Location
    Denmark
    Posts
    983
    I ran into a little problem being a html idiot...

    I got the background picture thing working just fine, I just have a little problem with where to place the script from catbert..could you give me a pointer..

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Welcome</title>
    <style type="text/css">
    <div id="movie.swf">
    #movie {
    position: absolute;
    left: 50%; top: 50%;
    margin: -200px 0 0 -250px; padding: 0;
    }


    body
    {
    background: #00ff00 url('back.png') no-repeat fixed center;
    }
    </style>
    </head>
    <body bgcolor="#ffffff">

    </div>
    </object>
    </body>
    </html>


    thanks..
    http://www.rickigregersen.com ...finally a blog!

    Your damned if you do...but your particually damned if you don´t

  7. #7
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    Code:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Welcome</title>
    <style type="text/css">
    #movie {
      position: absolute;
      left: 50%; top: 50%;
      margin: -200px 0 0 -250px; padding: 0;
    }
    
    body { 
      background: #00ff00 url('back.png') no-repeat fixed center; 
    }
    </style>
    </head>
    <body>
    <div id="movie">
    The object and embed tags for your movie go in here
    </div>
    </body>
    </html>

  8. #8
    ReMember gobbles's Avatar
    Join Date
    Nov 2002
    Location
    Denmark
    Posts
    983
    Thanks again.. I want a new header saying "helping Catbert303 getting 10.000 posts.."
    http://www.rickigregersen.com ...finally a blog!

    Your damned if you do...but your particually damned if you don´t

  9. #9
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222

  10. #10
    ReMember gobbles's Avatar
    Join Date
    Nov 2002
    Location
    Denmark
    Posts
    983
    Sorry I just cant figure out what is what any longer..
    My swf is called disko.swf and its 550x400
    Could you help get it working then I might see the logic..

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>velkommen</title>
    <style type="text/css">
    #movie {
    position: absolute;
    left: 50%; top: 50%;
    margin: -275px 0 0 -200px; padding: 0;
    }

    body {
    background: #00ff00 url('back.png') no-repeat fixed center;
    }
    </style>
    </head>
    <body>
    <div id="movie">
    <table align="center">
    <tr>
    <td align="center"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="550" height="400" id="movie" align="middle">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="movie" value="disko.swf" />
    <param name="menu" value="false" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#ffffff" />
    <embed src="disko.swf" menu="false" quality="high" bgcolor="#ffffff" width="550" height="400" name="movie" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    </div>
    </body>
    </html>
    http://www.rickigregersen.com ...finally a blog!

    Your damned if you do...but your particually damned if you don´t

  11. #11
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    Code:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>velkommen</title>
    <style type="text/css">
    #movie {
      position: absolute;
      left: 50%; top: 50%;
      margin: -200px 0 0 -275px; padding: 0;
    }
    
    body { 
      background: #00ff00 url('back.png') no-repeat fixed center; 
    }
    </style>
    </head>
    <body>
    <div id="movie">
      <object classid="clsid:D27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="550" height="400">
        <param name="allowScriptAccess" value="sameDomain" />
        <param name="movie" value="disko.swf" />
        <param name="menu" value="false" />
        <param name="quality" value="high" />
        <param name="bgcolor" value="#ffffff" />
        <embed src="disko.swf" menu="false" quality="high" bgcolor="#ffffff" width="550" height="400" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
      </object>
    </div>
    </body>
    </html>

  12. #12
    ReMember gobbles's Avatar
    Join Date
    Nov 2002
    Location
    Denmark
    Posts
    983
    Perfect thanks..
    http://www.rickigregersen.com ...finally a blog!

    Your damned if you do...but your particually damned if you don´t

  13. #13
    Junior Member
    Join Date
    Jan 2005
    Posts
    14
    I found i just had too add <center> near top of my html file and </center> near bottom.

  14. #14
    Senior Member Cass101's Avatar
    Join Date
    Dec 2004
    Posts
    131
    using <center></center> only centers the movie on a horizontal scale, not vertical. The method catbert suggested would position the .swf to the centre on both.

    Also, using the <center> tags is becoming a deprecated feature of W3C's HTML standards, so is best to try not to use if possible, and keep with CSS.

  15. #15
    ReMember gobbles's Avatar
    Join Date
    Nov 2002
    Location
    Denmark
    Posts
    983
    Yes I actually tried that but the movie was only centered horizontaly and was place "1cm" from the top every time...same thing using "middle"
    http://www.rickigregersen.com ...finally a blog!

    Your damned if you do...but your particually damned if you don´t

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center