new Embed stuff in your pages: Embed flash games in your site
Add to Technorati Favorites

Wednesday, March 28, 2007

Embed flash games in your site

Embedding flash games in your site is just as simple as embedding youtube videos. Take the absolute location of the swf file and write the following code, making sure that the src attribute for the embed tag is replaced with the URL to the swf file.

Here's the code:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="400" height="300">
<param name=movie value="week13/images/copter.swf">
<param name=quality value=high>
<embed src="http://www.hurtwood.demon.co.uk/Fun/copter.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="400" height="300">

</embed>
</object>


And here's how the game looks like. Give it a try!






2 comments:

lavaking said...

well i tried to add a flash file but for some reason i get an error report and i did what you said and copied the code then i replaced the "srf" with the url but it didn't work. do you know what could be wrong?

Marius Hanganu said...

You have to download the file. I think that embedding swf-s from other domains enters the XSS jurisdiction (cross site scripting).