2011-08-10

【紫色筆記】swfobject 符合W3C標準且隨插即用的 Flash

用 DreamWeaver 插入 flash 雖然方便,但其實它是不符合W3C標準的語法!且程式勒勒長又看不懂…

我們利用 Adobe 發表的 swfobject 可以來解決其問題~

【第一步】官網的 Downloads 下載 SWFObject 2.2.zip (Uploaded:Jun 11, 2009)

【第二步】解壓縮後把「swfobject.js」檔存到你的網站資料夾中

【第三步】開啟網頁檔,把下列指令加到 <head> </head> 中


<script type="text/javascript" src="swfobject.js"></script>


【第四步】把下列程式片段加到欲插入Flash動畫的地方


<div id="mySWF">這裡是當 flash 不能正常顯示時顯示的内容</div>
<script type="text/javascript">
swfobject.embedSWF("banner.swf", "mySWF", "300", "143", "9.0.0");
</script>

  • 註:swfobject.embedSWF(swfUrl, id, width, height, version)是5個必須的參數
  • swfUrl(String)指定SWF的URL
    id(String)指定將會被Flash内容替換的HTML元素的id
    width(String)指定SWF的寬
    height(String)指定SWF的高
    version(String)指定你發佈的SWF對應之Flash Player版本(格式為:major.minor.release)


相關網站:swfobject 官方網站
參考來源:蕃茄腦袋-SWFObject 2.0 讓你輕鬆的插入及控制 Flash

1 則留言:

  1. To become a viable industrial production option, there are a couple of challenges that 4D printing should overcome. The challenges of 4D printing embody reality that|the truth that} the microstructures of those printed smart supplies have to be close to or higher than the elements CNC machining obtained via traditional machining processes. New and customizable supplies need to be developed which have the power to persistently reply to varying exterior stimuli and alter to their desired shape.

    回覆刪除