2012-06-18 104 views
0

我正在修改Flash頁面以在Flash不可用時顯示替代內容,但是,它使用的方法對於包含大量內容的全功能替代頁面並不十分理想。目前,可供選擇的內容供應這樣的:提供替代Flash內容

var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision); 
if(hasRightVersion) { // if we've detected an acceptable version 
    if (AC_FL_RunContent == 0) { 
     alert("This page requires AC_RunActiveContent.js. In Flash, run \"Apply Active Content Update\" in the Commands menu to copy AC_RunActiveContent.js to the HTML output folder."); 
    } else { 
     // embed the flash movie 
     AC_FL_RunContent(
       'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0', 
       'width', '1000', 
       'height', '688', 
       'src', 'wot', 
       //etc, etc... 
     ); //end AC code 
    } 
} else { // flash is too old or we can't detect the plugin 
    var alternateContent = 
      '<p>&nbsp;</p>' 
      + '<p>This website requires a newer version of the Adobe Flash Player.</p>' 
      + '<p>&nbsp;</p>' 
      + '<p>&nbsp;</p>' 
      + '<p><a href="http://www.macromedia.com/go/getflash/">Get the Latest Flash Player here.</a></p>' 
      + '<p><a href="http://www.macromedia.com/go/getflash/"><img src="images/get_flash_player.gif" alt="Download Flash Player" width="88" height="31" border="0" /></a></p>' 
      + '<p>&nbsp;</p>' 
      + '<p>&nbsp;</p>'; 
    document.write(alternateContent); // insert non-flash content 
} 

新的內容我想爲多,比「讓閃電俠」的消息大得多,但是。

有沒有更好的方式來提供大量的HTML(和JavaScript)?通過包括某種?我不確定我想做任何類型的重定向 - 或者我?

回答

2

最好的辦法就是使用SWFObject的,

與您的備用系統一個div裏面,然後使用SWFObject的加載該div裏面的flash播放器,如果已安裝Flash Player

看:如何在此頁面上使用SWFObject動態發佈嵌入Flash Player內容:http://code.google.com/p/swfobject/wiki/documentation

下:如何使用HTML配置Flash內容?

flashvars devicefont (more info) 
allowscriptaccess (more info here and here) 
seamlesstabbing (more info) 
allowfullscreen (more info) 
allownetworking (more info) 

你需要將它們送入您的參數,

var params = {allowscriptaccess:'always', allownetworking:'allways'} 

然後哺養嬰兒車到您的裝載機線

+0

這只是一些作品,但這可能是因爲我不太熟悉原始閃光燈如何放在一起。當我在測試頁上嘗試時,音樂加載不正確,與我在現場看到的不同。無論如何可以使用上面的代碼,因爲我知道Flash可以正常工作。 這裏的網址:http://wot-sound.co.uk/ 而我的測試執行:http://lisadearaujo.com/clientaccess/wot-sound/indexFlash.htm – yolise

0

除了HotHeadMartin的回答是:這裏有一個很好的代碼生成器:
http://www.bobbyvandersluis.com/swfobject/generator/index.html

只需選擇「動態發佈」並填寫一些文本字段。

+0

謝謝你們倆對於遲到的回覆感到遺憾(花了我很長時間才能訪問服務器)。完美工作。 (對不起 - 沒有足夠的分數投票您的評論,strah) – yolise