全屏 Flash 幻灯片

发布于 2024-11-11 22:04:43 字数 1238 浏览 4 评论 0原文

以前,我开发过一个 Flash 应用程序,该应用程序将嵌入到 100x20 的网页中,该网页加载基于 XML 的按钮图形。单击该按钮后,应用程序将通过 AS3 全屏显示。

stage.displayState = StageDisplayState.FULL_SCREEN;

这非常有效 - 应用程序按预期全屏显示。

今天,我需要重新开发应用程序,以便 SWF 通过 JavaScript 全屏启动(以便他们可以将启动功能添加到链接等)。

我将上述代码从 _click(e:MouseEvent) 函数中移出,并将其直接放入应用程序文档类的构造函数中。但是,当它嵌入网页时,这不起作用?当我在 PC 上打开 SWF 时,它工作正常(立即全屏启动)。只是不想在网页上发生。

这是我用来加载 SWF 的 JS。

// vars
var xml = <?php echo $_GET["xml"]; ?>;

/**
 * Launch fullscreen flash slideshow
 */
function launch()
{
    var object = '<object width="1" height="1"><param name="allowfullscreen" value="true" />';
    object += '<param name="wmode" value="transparent" /><param name="flashvars" value="xmllocation=http%3A%2F%2Fimagetrack.com.au%2Fsc%2Fsc.xml%3Fid%3D' + xml + '" />';
    object += '<embed width="1" height="1" src="application.swf?xmllocation=http%3A%2F%2Fimagetrack.com.au%2Fsc%2Fsc.xml%3Fid%3D' + xml + '" wmode="transparent" allowfullscreen="true" />';
    object += '</object>';

    var e = $(object);
    var p = $("body");

    p.append(e);
}

显然,这只是将对象附加到页面。我还有其他方法可以解决这个问题吗?或者我只是错过了一些简单的事情?我猜原因是全屏被阻止,除非它是用户启动的。

Previously I'd worked on a flash application that would be embedded into a webpage at 100x20 that loaded a graphic for a button based on XML. When the button was clicked, the application would go full-screen via AS3.

stage.displayState = StageDisplayState.FULL_SCREEN;

This worked great - the application went full-screen as expected.

Today I need to redevelop the application so that the SWF will launch full-screen via JavaScript (so that they can add the launch functionality to a link and whatnot).

I moved the above code from the _click(e:MouseEvent) function and placed it straight into the constructor of the application document class. However this doesn't work when it's embedded on a web page? When I open the SWF on my PC it works fine (launches into full-screen straight away). Just doesn't wanna happen when it's on a web-page.

Here is the JS that I am using to load my SWF.

// vars
var xml = <?php echo $_GET["xml"]; ?>;

/**
 * Launch fullscreen flash slideshow
 */
function launch()
{
    var object = '<object width="1" height="1"><param name="allowfullscreen" value="true" />';
    object += '<param name="wmode" value="transparent" /><param name="flashvars" value="xmllocation=http%3A%2F%2Fimagetrack.com.au%2Fsc%2Fsc.xml%3Fid%3D' + xml + '" />';
    object += '<embed width="1" height="1" src="application.swf?xmllocation=http%3A%2F%2Fimagetrack.com.au%2Fsc%2Fsc.xml%3Fid%3D' + xml + '" wmode="transparent" allowfullscreen="true" />';
    object += '</object>';

    var e = $(object);
    var p = $("body");

    p.append(e);
}

Which obviously just appends the object to the page. Is there another way I can go about this? Or am I just missing something simple? I'm guessing the reason is that full-screen is blocked unless it's user-initiated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

や三分注定 2024-11-18 22:04:43

这是闪存安全限制。如果没有通过点击事件明确执行此操作,您绝对无法将 Flash 启动为全屏。

http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3 /WS5b3ccc516d4fbf351e63e3d118a9b90204-7c5d.html

This is a flash security restriction. You absolutely cannot launch flash into fullscreen without explicitly doing so from a click event.

http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7c5d.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文