Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting if fullscreen is allowed in ActionScript 3.0?

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.

like image 722
jspooner Avatar asked Mar 18 '09 17:03

jspooner


2 Answers

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            
}
like image 187
Jotham Avatar answered Oct 13 '22 12:10

Jotham


SOLUTION FOR AS3

you can check if full screen is allowed via the stage properties, example for my case

try {
    if (btn.stage["allowsFullScreen"]) { // if this fails, then its not allowed
        // do full screen allow code here
        btn.alpha = 1; // show since its allowed
    }
} catch (error:Error) { // full scrren not allowed
    btn.alpha = 0.5; // dim since it cant be used
}
like image 32
mihai Avatar answered Oct 13 '22 12:10

mihai