Groups | Blog | Home
all groups > flash actionscript > september 2007 >

flash actionscript : JavaScript controlled fullscreen for FLVPlayBack CS3 AS3


GetCoding
9/20/2007 9:01:36 PM
I am working on a flash player in AS3, and the default skin fullscreen button
works. However, I want to use JavaScript to control the fullscreen behavior,
and even launch the player fullscreen when playing. The problem I am
encountering is a security error. I have allowFullScreen = true and
Security.allowDomain('mydomain.com') set.

SecurityError: Error #2152: Full screen mode is not allowed.
at flash.display::Stage/set displayState()
at buble_player_fla::MainTimeline/handle_fullscreen()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at ()
at
flash.external::ExternalInterface$/flash.external:ExternalInterface::_callIn()
at ()

What is odd is I can tell the player to go to normal screen from fullscreen,
but not the other way around.

I looked at the flvplayback.as file and noticed that the fullscreen control is
attached to the component _vc.stage.displayState =
StageDisplayState.FULL_SCREEN; to launch fullscreen when handled by the
fullscreen button event.

I've tried both stagestage.displayState = StageDisplayState.FULL_SCREEN;
and FLVPlayBack.stage.displayState = StageDisplayState.FULL_SCREEN;

Both result in the error, any ideas as to what I am missing? why is this
sandboxed from outside the player?
GWD
9/20/2007 9:10:57 PM
I believe from memory that an event in flash has to preceed the fullscreen
enabled mode from being enabled - keypress or mousepress. This is to prevent,
for example, someone using code to set Fullscreen to true without user
intervention/decision. I suspect this is why exiting fullscreen is permitted
but not entering full screen code, even from javascript.
Can't say for sure, but it makes sense given the 'rules' for fullscreen.


GetCoding
9/21/2007 5:31:25 AM
You are correct, my predecessor player in AS2 didn't suffer the same sandbox
security that the AS3 player suffers from.


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

"The ActionScript that initiates full-screen mode can be called only in
response to a [b]mouse event[/b] or [b]keyboard event[/b]. If it is called in
other situations, Flash Player throws an exception."

So much for externalizing the fullscreen control outside the player :(

Hopefully the context menu will still allow for a toggle fullscreen function.
My old player has that feature, it would be nice to port it to my AS3 prototype.
AddThis Social Bookmark Button