如何从 javascript 检查 Flash 对象是否处于全屏模式

发布于 2024-12-10 11:48:47 字数 182 浏览 0 评论 0原文

我需要从 JavaScript 检查给定的 Flash 对象是否处于全屏模式。我知道有 stage.displayState 属性,但如何使用 GetVariable 访问它?或者也许还有另一种方法?

谢谢。

PS 如果你知道如何用其他语言做到这一点,那也没关系。

I need to check from javascript that given flash object is in fullscreen mode. I know that there is stage.displayState property but how to access it using GetVariable? Or maybe there is another way?

Thanks.

P.S. If your know how to do that from any other language it is ok too.

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

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

发布评论

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

评论(1

写给空气的情书 2024-12-17 11:48:47

您可能需要在 AS 内添加一个可以从 JS 层调用的函数:

// In your AS code
import flash.external.ExternalInterface;
import flash.display.StageDisplayState;

// Register a function you can call from JS
ExternalInterface.addCallback("isFullScreen", _isFullScreen);

// Returns true if fullscreen
private function _isFullScreen() :Boolean {
    return stage.displayState === StageDisplayState.FULL_SCREEN:
};

然后,您应该能够从 JS 调用它:

// Get a reference to the object element, change
// 'flashcontent' to the ID of your .swf in the DOM
var o = document.getElementById('flashcontent'),
    // Figure out it the player is in fullscreen mode
    isFullScreen = o.isFullScreen();
// Do something with isFullScreen value

ExternalInterface 文档 此处,舞台显示状态此处

希望有帮助。干杯!

you'll probably need to add a function inside AS that you can call from the JS layer:

// In your AS code
import flash.external.ExternalInterface;
import flash.display.StageDisplayState;

// Register a function you can call from JS
ExternalInterface.addCallback("isFullScreen", _isFullScreen);

// Returns true if fullscreen
private function _isFullScreen() :Boolean {
    return stage.displayState === StageDisplayState.FULL_SCREEN:
};

then, you should be able to call it from JS:

// Get a reference to the object element, change
// 'flashcontent' to the ID of your .swf in the DOM
var o = document.getElementById('flashcontent'),
    // Figure out it the player is in fullscreen mode
    isFullScreen = o.isFullScreen();
// Do something with isFullScreen value

docs for ExternalInterface here, stage display state here.

hope that helps. cheers!

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