Thursday 18 February 2010

True Full Screen in Flash Player 7 or 8

Most flash based video players have a "full screen" option that makes the video fill your screen even if it originated from a small square in a web page.

But it can be used to make any SWF file fill the screen.

I use both MX 2004 or CS3 depending on which computer I am using. And I know there are still a lot of MX or 8 users out there. So, in case I forget, and in case anyone else finds it helpful, here's how you do full screen in MX 2004 or 8.

The whole thing is summed up in detail here:
http://www.adobe.com/devnet/flashplayer/articles/full_screen_mode.html

The ActionScript

Here is my AS2 implementation:

/*first set the initial fullscreen value which is 0 because we are not yet in fullscreen */
var fullscr_status = 0;
/*Then a function that runs when the fullscreen button is pressed, this tests whether we are in fullscreen (1) or not (0). If not we go into fullscreen mode. If allready in fullscreen mode we come out of it. */
_root.button_btn.onRelease = function() {
if (fullscr_status == 0) {
//Fullscreen on
fullscr_status = 1;
Stage["displayState"] = "fullScreen";
} else if (fullscr_status == 1) {
//Fullscreen off
fullscr_status = 0;
Stage["displayState"] = "normal";
}
};

The thing that is different for MX 2004 and 8, when compared to using ActionScript 2 in CS3 is this:

Stage["displayState"] = "fullScreen";

and

Stage["displayState"] = "normal";

these are different in CS3.

The HTML

The fullscreen ActionScript won't have any effect unless the object and embed parameters are set to allow fullscreen as follows:

For object:

param name="allowFullScreen" value="true"


For embed:

allowFullScreen="true"


The HTML object and embed I use is described on the Adobe site here:
http://www.adobe.com/devnet/flashplayer/articles/full_screen_mode_04.html

An Example

Just click the square.





No comments:

Post a Comment