What kind of preloader is this? Are you using some kind of javascript preloader that shades the site and preloads the page? How does preloading affect your need to change the CSS? Does the SWF resize itself?
If you're not very familiar with JavaScript it's best to get a framework that will handle things like browser differences for you. jQuery is a very popular and easy to use framework. You could use the AS ExternalInterface class to inform JavaScript that your Flash has finished loading and use jQuery to measure and align your SWF object. You'd need a resize event handler to adjust the position as needed also in the event the user resizes the browser.
Although I think just keeping it simple with CSS is best. I just don't understand why a preloader isn't allowing CSS to work unless the SWF actually changes size.
An example of a JavaScript function using jQuery that ExternalInterface could call to reposition the SWF, assuming the SWF has the id="MainSWF":
// javascript $(document).ready(function() { // resize listener $(window).resize(function() { AlignElements(); }); // make sure SWF is absolute positioned $('#MainSWF').css({'position':'absolute'}); // call it to start AlignElements(); }); function AlignElements() { // use top/left properties to align SWF var left = Math.round(($(window).width() - $('MainSWF').width()) / 2) + 'px'; var top = Math.round(($(window).height() - $('MainSWF').height()) / 2) + 'px'; $('#MainSWF').css({'left':left,'top':top}); } |
AS:
// AS, called when SWF finished preloading ExternalInterface.call("AlignElements"); |
Make sure you download and load jQuery into your pages so it's available or that won't work. There's plenty of other JavaScript frameworks you might like more or are overall lighter on page load for this basic stuff. Looking around doesn't hurt.