A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: problems centering flash in html

  1. #1

    problems centering flash in html

    i have a movie whose size is the default(550x400)
    how do i center it when i publish it in html?

  2. #2
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    In the html file created by flash add a div tag around the object and embed tags for the movie and give this div tag an id attribute with the value my-movie,

    e.g.

    <div id="my-movie">
    the object and embed tags here
    </div>

    then somewhere between the opening <head> and closing </head> tags add the following css,

    Code:
    <style type="text/css">
    #my-movie {
        position: absolute;
        left: 50%; top: 50%;
        margin: -200px 0 0 -275px; padding: 0;
    }
    </style>
    the values for the margins depend on the size of the movie, if you changed the size of the movie these would need to be updated. the values should be,

    margin: -(half the height of the movie)px 0 0 -(half the width of the movie)px;

  3. #3
    thanks man!

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