我需要从javascript检查给定的flash对象是否处于全屏模式。我知道有stage.displayState
属性但是如何使用GetVariable
访问它?或许还有另一种方式?
感谢。
P.S。如果你知道如何用其他任何语言做到这一点,也可以。
答案 0 :(得分:2)
你可能需要在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
希望有所帮助。干杯!