Detecting if fullscreen is allowed in ActionScript 3.0?

jspooner picture jspooner · Mar 18, 2009 · Viewed 7.2k times · Source

I would like to remove a fullscreen button if the allowfullscreen param is false.
      param value="true" name="allowfullscreen"

Does anyone know if its possible to detect that value? It doesn't come with other flashvars on loaderInfo.parameters.

Answer

Jotham picture Jotham · Mar 18, 2009

The member you want is

stage.displayState

It can be assigned like so:

import flash.display.StageDisplayState;

....

stage.displayState = StageDisplayState.FULL_SCREEN;
stage.displayState = StageDisplayState.NORMAL;

I recommend reading:

http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000352.html

[Edit:

Oh man, totally misread your question.]

After a little test it looks like you can just use the exception mechanism to test for it without any perceptable flicker:

try
{
    stage.displayState = StageDisplayState.FULL_SCREEN;
    stage.displayState = StageDisplayState.NORMAL;
} catch ( error:SecurityError ) {
// your hide button code            
}