-
Fullscreen doesn't work
I try to open my swf in fullscreen mode by user clicking the button, without any success for now. I keep getting the "SecurityError: Error #2152: Full screen mode is not allowed."
My HTML looks OK with all possible allowFullScreen parameters set to true.
I suspect that my problem might be in the fact that I use lots of external swfs in my application. And to close the Error alert window I have to click several times on it.
How can I make my "fullscreen" button work?
I honestly searched Internet and Flashkit forums for the answer to my problem, but looks like nobody else was having it.
-
1 Attachment(s)
Hi olka_sb,
The ActionScript that initiates full-screen mode can be called only in response to a mouse event or keyboard event. If it is called in other situations, Flash Player throws an exception.
For more information on this go to http://help.adobe.com/en_US/ActionSc...0204-7c5d.html
PHP Code:
stage.addEventListener (KeyboardEvent.KEY_DOWN, this.goFullScreen);
//
function goFullScreen (param1:KeyboardEvent):void
{
if (param1.keyCode == 32)
{
switch (stage.displayState)
{
case "normal" :
stage.displayState = "fullScreen";
break;
case "fullScreen" :
default :
stage.displayState = "normal";
break;
}
}
}
-
Thank you for the answer. It exactly pointed to my mistake.
When I wanted to reply that my user does click the button to open fullscreen, I checked my code and found that instead of doing it from the click handler in one class (menu class), I sent event to the other class (layout class) and tried to open fullscreen from there.
Looks like the only place where I can put string
"stage.displayState = StageDisplayState.FULL_SCREEN;"
is the click handler itself.
It's working now. Thanks!