Embed SWF Files Via Javascript – Active Content Script

Previously We used to embed flash files in web pages via simple embed method which pops up flash settings alert or Flash Settings Manager. Following way is to embed Flash movie (swf file) in web page using Javascript which will play for all browsers and will not alert you for flash settings.

Old Way Of Embeding SWF In Web Pages
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="200" height="100">
<param name="movie" value="mymovie.swf">
<param name="quality" value="high">
<param name="menu" value="false">
<embed src="mymovie.swf" width="200" height="100" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false"></embed>

We had to go to Flash Global Settings Manager to set settings to stop that pop up window.

New Adobe Dreamweaver CS3 provides a way to embed flash files in web pages via javascript by using AC_RunActiveContent.js file.

Suppose I have swf movie named as mymovie.swf. I will embed it in web page by using following method. You will need AC_RunActiveContent.js file which Adobe Dreamweaver provides while you embed swf in web pages.

For Head Section Of Page
<script src="AC_RunActiveContent.js" type="text/javascript"></script>
Embeding SWF Via Javascript
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','200','height','100','src','mymovie','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','mymovie' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="200" height="100">
  <param name="movie" value="mymovie.swf">
  <param name="quality" value="high">
  <embed src="mymovie.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="200" height="100"></embed>

* For above example, you will have to change the movie name at four places. Two times it appears as mymovie.swf and two times as mymovie in code above and movie’s height and width three times too.

Download Full Script