<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>如何使用swfObject</title>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
//用swfobject啟用SWF內容
swfobject.embedSWF("test.swf", "swfContent", "600", "400", "9.0.0", "expressInstall.swf");
//swfobject.embedSWF(欲放入的flash影片, 要放置的區域ID, 寬, 高, 檢查的FlashPlayer版本, 替代的SWF檔);
</script>
</head>
<body>
<div id="swfContent">
給使用者一段資訊, 當使用者的瀏覽器不支援Javascript
</div>
</body>
</html>
----------------------------------------
需要檔案如下
swfobject.js
expressInstall.swf
官網
http://code.google.com/p/swfobject/
----------------------------------------
完整參數說明:
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調用地址;如果使用者Flash Player版本低於flashVersion將自動更新。
flashvars為flashvars傳遞的變量值;
params為flash player控件的參數設定;如menu="false" ;
attributes為flash player控件的屬性值設定;如class="flashstyle";
範例:
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
var flashvars = {};
flashvars.sn = "a00001";
var params = {};
params.menu = "false";
params.quality = "autohigh";
params.wmode = "opaque";
params.allowfullscreen = "true";
params.allowscriptaccess = "always";
params.allownetworking = "all";
var attributes = {};
swfobject.embedSWF("test.swf", "flashcontent", "300", "120", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
</script>
沒有留言:
張貼留言