Width/Height Auto-detection

Here is my problem. As you know, flash files don’t behave the same what when you ignore width/height parameters as images. Images simply show their true dimensions, while flash files show… god knows what.

Im building up a flash game database, and each one has different dimensions. Im using a custom script to manage my database, and the dimensions were hard-coded into the page that displays the flash file, like so:

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="600" height="400" align="center">
 	  <PARAM NAME=movie VALUE="http://www.omfgmedia.com/games/<? echo $filename; ?>">
 	  <PARAM NAME=quality VALUE=high>
 	 <EMBED src="http://www.omfgmedia.com/games/<? echo $filename; ?>" width="600" height="400" quality=high TYPE="application/x-shockwave-flash"
 PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"> </EMBED>
 	</OBJECT>

This raises problems, since not all flash files are that size, or have that width to height ratio, so some games have horizontal or vertical bars which shouldn’t be there. I could code width/height variables into each database entry for the game, but that would mean I would have to measure each game to find its true dimensions, which is a very painstaking process.

Is there a way to have javascript or whatever plugin auto-detect the true width/height and substitute the width/height variables with proper values so the game displays properly?