SWFObject2.0兩種調用方式

來源:互聯網
上載者:User

 SWFObject是簡單易用的Flash嵌入和檢測JS代碼,個人覺得比Adobe官方提供要更為方便,也更為易用的。這次版本更新改動非常大。
SWFObject2.0現提供兩個主要調用方法。
1.swfobject.registerObject(flashContentId, flashVersion,expressInstallUrl );
flashContentId為Flash的ID;
flashVersion為播放SWF的Player版本;
expressInstallUrl為Flash Player更新安裝的swf調用地址;如果目前的版本低於flashVersion將自動更新。

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> </p><p><head> </p><p><title>SWFObject v2.0 sample page</title><br /><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </p><p><mce:script type="text/javascript" src="swfobject.js" mce_src="swfobject.js"></mce:script><br /><mce:script type="text/javascript"><!--</p><p>swfobject.registerObject("myId", "9.0.0", "expressInstall.swf");<br />// --></mce:script><br /></head><br /><body> </p><p><div> </p><p><object id="myId" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="300" height="120"> </p><p><param name="movie" value="test.swf" /> </p><p><div> </p><p><h1>Alternative content</h1><br /><p><br /><a href="http://www.adobe.com/go/getflashplayer" mce_href="http://www.adobe.com/go/getflashplayer"><br /><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" mce_src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /><br /></a></p><br /></div><br /></object><br /></div><br /></body><br /></html><br />

 

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> </p><p><head> </p><p><title>demo</title><br /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </p><p><mce:script type="text/javascript" src="swfobject.js" mce_src="swfobject.js"></mce:script><br /><mce:script type="text/javascript"><!--</p><p>var flashvars = {}; </p><p>flashvars.sn = "a00001"; </p><p>var params = {}; </p><p>params.menu = "false"; </p><p>params.quality = "autohigh"; </p><p>params.wmode = "opaque"; </p><p>params.allowfullscreen = "true"; </p><p>params.allowscriptaccess = "always"; </p><p>params.allownetworking = "all"; </p><p>var attributes = {}; </p><p>swfobject.embedSWF("test.swf", "flashcontent", "300", "120", "9.0.0", "expressInstall.swf", flashvars, params, attributes);<br />// --></mce:script><br /></head><br /><body> </p><p><div id="flashcontent"> </p><p><a href="http://www.adobe.com/go/getflashplayer" mce_href="http://www.adobe.com/go/getflashplayer"> </p><p><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" mce_src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" border="0" /> </p><p></a></div></body><br /></html><br />

2.swfobject.embedSWF(swfUrl, replaceElementId, swfWidth, swfHeight, flashVersion,expressInstallUrl, flashvars, params, attributes);
swfUrl為調用swf的地址;
replaceElementId為要用於替換成flash的可顯示容器的ID;
swfWidth為swf的寬度;
swfHeight為swf的高度;
flashVersion為播放SWF的Player版本;
expressInstallUrl為Flash Player更新安裝的swf調用地址;如果目前的版本低於flashVersion將自動更新。
flashvars為flashvars傳遞的變數值;
params為flash player控制項的參數設定;如menu="false" ;
attributes為flash player控制項的屬性值設定;如class="flashstyle";

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.