Flash Fullscreen Fun

While delving deep into the mysteries of Actionscript 3.0, I came across something that really made me smile. Apparently the Flash Player 9.x allows for FullScreen mode. I must have been living in a cave for the past couple of years. How have I never seen this before?

Click anywhere on the video to go to fullscreen mode.

The great thing is how easy it is to do. Here is a handler that turns fullscreen mode on and off.

private function FullScreenSwitch(event:Event):void {
  if (StageDisplayState.FULL_SCREEN == stage.displayState) {
    stage.displayState = StageDisplayState.NORMAL;
  else {
    stage.displayState = StageDisplayState.FULL_SCREEN;

There are a few caveats to the system and one of them is really frustrating.

First: fullscreen mode can only be set by the user interacting with something, such as clicking with the mouse. Fullscreen mode can't just be dynamically turned on without any user interaction. Fair enough. I think I'd be pretty ticked if web sites had banner ads that suddenly went fullscreen on their own.

Second: a little text blurb shows up when the video switches to text mode telling the user they can switch it off by hitting the Escape key. This fades away after a couple of seconds. Again, I think this is great. You don't want someone who accidentally makes a Flash video full screen to not be able to get out of it.

Third: and very annoyingly, all keyboard inputs are blocked in fullscreen mode. What!?! Apparently Adobe thinks it is a huge security risk to allow keyboard input while in fullscreen mode. I don't understand this at all, and it totally ruins most of the great ideas I had for implementing fullscreen mode. Can you imagine how much cooler games would be if they were in fullscreen. Too bad! Unless they are mouse only games, you can't play them in fullscreen. Maybe that's why I hadn't heard of this until recently. Better than nothing, though.

For more detailed info on how it all works, check out this fullscreen tutorial over at Adobe.

This entry was posted in actionscript, Flash, Flex and tagged , , , , , , , . Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • franco

    If I want to use this in a button (so when clicked it will make the stage full screen and not when I click on the stage itself. How will I do this…can I just put the code above in a onRelease function or is there another way?

  • http://orangeSPLoTCH.com mattc

    That’s exactly what you need to do. Instead of
    stage.addEventHandler( ... , use mybutton.addEventHandler( ... to call the fullscreen function.