开发者

How to check from javascript that flash object is in fullscreen mode

开发者 https://www.devze.com 2023-04-13 08:14 出处:网络
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

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.


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!

0

精彩评论

暂无评论...
验证码 换一张
取 消