Select Page

Centering a Flash movie using HTML tables

The easiest way I have found to center a SWF both vertically and horizontally in HTML is using tables.

<table width="100%" height="100%" border="0">
        <td valign="middle" align="center">


Remove padding around 100% width/height Flash content

Some browsers put in padding around flash content that is scaled to fit 100% height and width. This is a quick CSS / HTML fix to make your full-screen flash movie fit the full height and width of the browser.
Just put this in the top of your HTML inside your CSS declaration

* {margin:0px;padding:0px;}

FlashVars AS3 – getting values from the URL string

Getting values from the URL string in AS3 isn’t very complicated. First you need to set up your html to pass these into the SWF using a javascript function:

Place this inside your html.
Then if you are using the default HTML publishing you need to set up your SWF to take the variable. In this example I’m looking for a variable called ‘transition’



The important lines are:

‘FlashVars’, ‘transition=’+gup(“transition”),
param name=”FlashVars” value=”transition=”+gup(“transition”)

Here we are calling the javascript function to return the value that matches ‘transition’. Then this gets passed to the SWF.

Inside the flash this can be accessed with:

var sTrans:String = String(stage.loaderInfo.parameters.transition)

Then you can get variables from the URL string: