« Top ten geek business myths | Search PHP & MySQL documentation from IE7 search box »

Flash player update adds full-screen support

13th October 2006

Adobe have released a beta update for the flash player on Adobe Labs. Among the new features are support for a full-screen mode on the web, so it won’t be long now before we have full-screen flash video and other content on web sites. The player version number is 9,0,18,60. It and the documentation are available on Adobe Labs. A brief summary of using full-screen mode in Actionscript 2 follows.

Flash movies can’t start in full-screen mode and can only switch to full-screen mode in response to a user action - either a button click or a key press. The facility to use full-screen mode is governed by a parameter in the object and embed tags. The parameter name is allowFullScreen and it defaults to false. Set it to true to enable full-screen mode -

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs
/flash/swflash.cab#version=9,0,18,0" width="550"
height="400">
   <param name="allowFullScreen" value="true" />
   <param name="movie" value="fullscreen.swf" />
   <embed src="fullscreen.swf" allowFullScreen="true"
      width="550" height="400"
      type="application/x-shockwave-flash"
      pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

On its own, this isn’t enough to enter full-screen mode. You also need a little bit of Actionscript -

Stage.displayState = "fullScreen";

and to switch back from full-screen mode -

Stage.displayState = "normal";

As mentioned before, this code must be run in response to a key press or a button click for it to work.

Unfortunately, if you just type this in and compile your movie, you’ll get an error. that’s because Flash 8 knows nothing about the new displayState property on the Stage class. There’s two ways around this. The first is to add the appropriate code to the Stage intrinsic class, so open the Stage class file in your flash installation - for the English version this is at Flash 8/First Run/Classes/FP8/Stage.as - and add the following line of code after the other property declarations -

static var displayState:String;

The second, uglier but easier, option is to simply use the associative array syntax to access the new property, so use

Stage["displayState"] = "fullScreen";

and

Stage["displayState"] = "normal";

There’s more info, demos and AS3 instructions in the Adobe Labs Wiki. Have fun.

Read more articles about Flash, Actionscript 2 

Comments closed.