javascript - 提供替代 Flash 内容

标签 javascript html 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
}

然而,我想要提供的新内容比“获取 Flash”消息要大得多。

是否有更好的方法来提供大量 HTML(和 JavaScript)?通过某种包含?我不确定我想要进行任何类型的重定向 - 或者我想要吗?

最佳答案

最好的方法是使用 SWFObject,

有一个 div ,其中包含您的备用系统,然后使用 SWFObject 在该 div 中加载 Flash 播放器(如果安装了 Flash 播放器)

查看:如何使用 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'}

然后将婴儿车送入装载机生产线

关于javascript - 提供替代 Flash 内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11084580/

相关文章:

c# - 局域网宠物项目

c++ - 与网络交互的程序

javascript - 再次强调 : TypeError: a. lat 不是 google map api 中的函数

javascript - 想要检查 NodeJS 中 console.log 的函数体

javascript - 无法在 appendchild 之后将表行与标题对齐

javascript - 嵌套 foreach 不起作用

javascript - 单击 <a> 链接时如何显示确认对话框?

flash - 在ActionScript 3中删除YouTube视频的声音

javascript - 如何访问使用 LINK 标签加载的第 3 方样式表的源代码?

javascript - 如何使用 java 服务器将消息发送到特定的 websocket 连接