24K Design Studio :: Blog :: A simple full screen toggle button in Flash AS3
Author:
Password:
A simple full screen toggle button in Flash AS3
23:00, 11 Apr, 2011
by James

Create a button and name it btn_fullsc on stage. Using the following code in action frame.

import flash.display.StageDisplayState;

function toggleFullScreen():void
{
if (stage.displayState == StageDisplayState.NORMAL) {
stage.displayState=StageDisplayState.FULL_SCREEN;
} else {
stage.displayState=StageDisplayState.NORMAL;
}
}

btn_fullsc.buttonMode = true;
btn_fullsc.addEventListener(MouseEvent.CLICK, buttonOnClick)

function buttonOnClick(event:MouseEvent):void
{
toggleFullScreen();
}

Compile and run the flash.

One more thing, make sure <param name="allowfullscreen" value="true" /> is added to the html page.

import flash.display.StageDisplayState;

function goFullScreen():void
{
    if (stage.displayState == StageDisplayState.NORMAL) {
        stage.displayState=StageDisplayState.FULL_SCREEN;
    } else {
        stage.displayState=StageDisplayState.NORMAL;
    }
}

btn_fullsc.addEventListener(MouseEvent.CLICK, _handleClick)

function _handleClick(event:MouseEvent):void
{
    goFullScreen();
}
Tags: AS3
Reply:
Your name:
Only visible to the author.

Tell us you are not a robot. What is captcha1captchaOcaptcha2

Reply
#1
vinod
17:19, 21 Apr, 2011
 
thanks friend that works to me and i also able to change the directions of arrows in the movieclip.
Reply
Your name:
Only visible to the author.

Tell us you are not a robot. What is captcha1captchaOcaptcha2

Reply
View the latest 5 entries.