javascriptflashactionscript-3externalinterface

Calling AS3 fullscreen with javascript


I got two AS3 functions. One that toggles fullscreen and one that is called with javascript with ExternalInterface that only logs "Hello World".

Both works well in the browser, but if I try to call the fullscreen function with javascript the same way, i get an error like this:

Error calling method on NPObject!

I googled that problem but that only had something to do with same domain access, and sinced it worked with the other function, it has to be something else.

What am I doing wrong?


Solution

  • The fullscreen mode can only be set by user input. So I'm affraid calling it from javascript is not allowed.

    Full-screen mode is initiated in response to a mouse click or key press by the user; the movie cannot change Stage.displayState without user input. Flash runtimes restrict keyboard input in full-screen mode. Acceptable keys include keyboard shortcuts that terminate full-screen mode and non-printing keys such as arrows, space, Shift, and Tab keys. Keyboard shortcuts that terminate full-screen mode are: Escape (Windows, Linux, and Mac), Control+W (Windows), Command+W (Mac), and Alt+F4.

    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/Stage.html#displayState