2010-07-13 58 views
0

我有一個flash視頻,名爲abc.swf,我想在用戶首次註冊到我們的網站時播放。然而,如果用戶沒有閃光燈,我需要它以簡單的方式告訴他們。Flash Embed:如果用戶未安裝Flash,如何添加顯示的消息而不是Flash視頻?

因爲這個原因,我試圖告訴他們如何下載flash與下面的HTML:

<div style="text-align:center;"> 
    <p><strong>You do not have Flash installed, or it is older than the required 10.0.0.</strong></p> 
    <p><strong>Click below to install the latest version and then try again.</strong></p> 
    <p><a target="_blank" href="https://www.adobe.com/go/getflashplayer"> 
     <img src="images/get_flash_player.png" width="112" height="33" alt="Get Adobe Flash player" /> 
    </a></p> 
</div> 

困難的部分(對我來說,希望不是你^^)是得到了只顯示當他們沒有安裝閃光燈時。以下是我迄今爲止:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" 
       codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" 
       width="720" height="488" id="xxx" align="middle"> 
      <param name="allowScriptAccess" value="sameDomain" /> 
      <param name="allowFullScreen" value="false" /> 
      <param name="movie" value="abc.swf" /> 
      <param name="quality" value="high" /> 
      <param name="wmode" value="gpu" /> 
      <param name="bgcolor" value="#ffffff" /> 
      <embed src="abc.swf" quality="high" wmode="gpu" bgcolor="#ffffff" 
      width="720" height="488" name="abc" 
      align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" 
      pluginspage="http://www.adobe.com/go/getflashplayer" /> 
      <div style="text-align:center;"> 
       <p><strong>You do not have Flash installed, or it is older than the required 10.0.0.</strong></p> 
       <p><strong>Click below to install the latest version and then try again.</strong></p> 
       <p><a target="_blank" href="https://www.adobe.com/go/getflashplayer"> 
        <img src="images/get_flash_player.png" width="112" height="33" alt="Get Adobe Flash player" /> 
       </a></p> 
      </div> 
</object> 

但不管他們是否有安裝或沒有閃光燈它顯示下載提示信息,並且它的視頻下顯示出來(或者如果安裝閃光燈視頻會)。

有沒有辦法做到這一點?謝謝!

回答

3

你可以使用SWFObject

<script type="text/javascript" src="swfobject.js"></script> 
<script type="text/javascript"> 
swfobject.embedSWF("abc.swf", "flashcontent", "720", "488", "10.0.0") 
</script> 

<div id="flashcontent"> 
<p><strong>You do not have Flash installed, or it is older than the required 10.0.0. </strong></p> 
<p><strong>Click below to install the latest version and then try again.</strong></p> 
<p><a target="_blank" href="https://www.adobe.com/go/getflashplayer"> 
<img src="images/get_flash_player.png" width="112" height="33" alt="Get Adobe Flash player" /> 
</a></p> 
</div> 

只需下載SWFObject的,地點在同一目錄下。然後將這段代碼複製並粘貼到你的頁面上,它應該做你想做的事。

+0

看起來非常簡單。非常感謝! – Garrett 2010-07-13 21:45:05

0

您應該使用javascript動態創建對象,然後檢查對象是否成功加載,如果沒有,則將消息打印到屏幕上。