This code seems to work fine. However, previously I was using absolute urls in the code, eg: http://www.example.com/images/advert.swf, and when I did that the file was not clickable on any page of my site that did not have the 'www'. So, if you went to example.com and tried to click the flash ad, it didn't work; if you went to www.example.com and clicked the flash ad it worked fine.
Does anyone know why this would be? Is it a setting in the formatting of the flash ad? I just feel like I would like to know for any future flash ads I set up. Thanks for any help.
This might solve the issue by looking at it from a different angle—you can (and should) redirect the user from the non www version to the the www version of the domain. You can do this fairly easily with .htaccess.
You might want to look at swfobject for embedding your flash too ;).