Skip navigation
Currently Being Moderated

Fullscreen button in Actionscript 2

Apr 5, 2012 6:48 AM

Hi everyone.  I hope someone can help me with this.  I'm having some problems making a fullscreen button in Actionscript 2 that works in a swf file.  You see, this document I'm making isn't going to be going on the web.  It's just going to be shown on a computer at company events.  However, I need a button that makes the document fullscreen, and none of the codes I've tried have seemed to work in the swf.  Here is the current code I'm working with:


//Don't scale the movie when the stage size changes


//Align the stage to the top left

Stage.align = "TL";

//Function to toggle between fullscreen and normal size

//the toggle fullscreen button calls this function when pressed

function toggleFullScreen(){

    //if normal size, go to fullscreen, else go to normal size







//Create a listener for each time the Stage is resized

var resizeListener:Object = new Object();

//Called each time the stage is resized

resizeListener.onResize = function () {

    //Move the button to the center of the screen




//Add the listener to Stage


  • Currently Being Moderated
    Apr 5, 2012 7:13 AM   in reply to Cuwen

    How you're doing it is fine. Chances are you might be accidently removing the listener from your button (say your button goes off the timeline and is reinstantiated because of a keyframe) and it no longer is assigned to that function. You should run it in the flash IDE and put a trace("Button Pressed"); in the button function just to see if the assignment is still valid when you think it should be.

    Mark as:
  • Currently Being Moderated
    Apr 5, 2012 7:32 AM   in reply to Cuwen

    I see you are setting a listener on "toggleFullScreenButton". I assume this is the instance name of your button? How did you assign "toggleFullScreenButton" to the function "toggleFullScreen()"?


    On the trace, just change the function like so:


    function toggleFullScreen(){

         // add a trace which appears in the output panel when you "TEST" your movie (e.g. CTRL+ENTER inside Flash)

         trace("Toggle full screen button was pressed");


         if (Stage.displayState == "normal") { Stage.displayState = "fullscreen"; }

         else { Stage.displayState = "normal"; }



    You must test the movie inside flash (CTRL or CMD + ENTER). Then you will see that message appear in the output panel when you press yout button. If you don't see the message you know you have an issue with assigning that button to the function toggleFullScreen();

    Mark as:
  • Currently Being Moderated
    Apr 5, 2012 11:09 AM   in reply to Cuwen

    Haha yes there's an extra brace after the function you pasted but I'm sure you found that.


    I thought you were running the SWF itself without HTML. Without HTML the SWF or a Projector with the code above would go fullscreen just fine


    Glad you got it working. Can you please mark this as solved.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (1)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points