full-screen mode in Actionscript 2

How to use full-screen mode in Actionscript 2:

_root.btn_mc.onRelease = function(){
    if(Stage["displayState"] == "normal"){
        Stage["displayState"] = "fullScreen";
    }else{
        Stage["displayState"] = "normal";
    }
}

var listener:Object = {};
listener.onFullScreen = function(isFullscreen:Boolean){
    if(isFullscreen){
        trace("entered full-screen mode");
    }else{
        trace("exited full-screen mode");
    }
}
Stage.addListener(listener);

Also see Exploring full-screen mode in Flash Player 9.

2 Responses to “full-screen mode in Actionscript 2”

  1. Andrei Bouaru says:

    Thanks! Thanks! Thanks!
    I’ve been looing for a way to find out if the swf container for my application is fullscreen or not to make some adjustments in the included swf…and your method does that perfectly …thanks again

  2. Geoff Hunt says:

    Perfect! Just what I was looking for. Short simple, and does a great job of going from fullscreen to normal screen with the listener.