Skip to main content
Inspiring
August 22, 2011
Answered

How to change controlbar to full screen?

  • August 22, 2011
  • 2 replies
  • 1089 views

function fullscreenOnClicked(e:MouseEvent):void {

     stage.displayState = StageDisplayState.FULL_SCREEN;

}

function fullscreenOffClicked(e:MouseEvent):void {

     stage.displayState = StageDisplayState.NORMAL;

     

}

function onFullscreen(e:FullScreenEvent):void {

      if (e.fullScreen) {

          

          // switch fullscreen buttons

          mcVideoControls.btnFullscreenOn.visible = false;

          mcVideoControls.btnFullscreenOff.visible = true;

                         

          // bottom center align controls

          mcVideoControls.x = (Capabilities.screenResolutionX - 480) / 2;

          mcVideoControls.y = (Capabilities.screenResolutionY - 36);

          btnMidPlay.x = stage.stageWidth / 2;

          btnMidPlay.y = stage.stageHeight / 2;

                    

          // size up video display

          vidDisplay.height      = (Capabilities.screenResolutionY);

          vidDisplay.width      = vidDisplay.height * 4 / 3;

          vidDisplay.x          = (Capabilities.screenResolutionX - vidDisplay.width) / 2;

    } else {

          // switch fullscreen buttons

        mcVideoControls.btnFullscreenOn.visible = true;

          mcVideoControls.btnFullscreenOff.visible = false;

          // reset controls position

          mcVideoControls.x = 0;

          mcVideoControls.y = 325;

          btnMidPlay.x = 240;

                btnMidPlay.y = 180;

          // reset video display

          vidDisplay.y = 0;

          vidDisplay.x = 0;

          vidDisplay.width = 480;

          vidDisplay.height = 360;

    }

}

my player 4:3

above script is like below

but i want like this

How to change or build my script?

This topic has been closed for replies.
Correct answer Kenneth Kawamoto

Normally you have a class for the video controller, and the class has a function to handle resize.

2 replies

relaxatraja
Inspiring
August 23, 2011
function onFullscreen(e:FullScreenEvent):void {
      if (e.fullScreen) {
          
          // switch fullscreen buttons
          mcVideoControls.btnFullscreenOn.visible = false;
          mcVideoControls.btnFullscreenOff.visible = true;
                         
          // bottom center align controls
          mcVideoControls.x = (Capabilities.screenResolutionX - 480) / 2;
          mcVideoControls.y = (Capabilities.screenResolutionY - 36);
          btnMidPlay.x = stage.stageWidth / 2;
          btnMidPlay.y = stage.stageHeight / 2;
                    
          // size up video display
          vidDisplay.height      = (Capabilities.screenResolutionY);
          vidDisplay.width      = vidDisplay.height * 4 / 3;
          vidDisplay.x          = (Capabilities.screenResolutionX - vidDisplay.width) / 2;
         mcVideoControls.width=stage.stageWidth;
     } else {           // switch fullscreen buttons         mcVideoControls.btnFullscreenOn.visible = true;           mcVideoControls.btnFullscreenOff.visible = false;           // reset controls position           mcVideoControls.x = 0;           mcVideoControls.y = 325;           btnMidPlay.x = 240;                 btnMidPlay.y = 180;           // reset video display           vidDisplay.y = 0;           vidDisplay.x = 0;           vidDisplay.width = 480;           vidDisplay.height = 360;     } }

The above will change the width of the single movieclip, but it is not the way to do that, you should seperate your inner clips and make your controls to certain width and reposition the controls within that. otherwise you will face the issue after implementing the above.

Inspiring
August 23, 2011

i separate single movieclip, but raising issues.

and i sent the file to u pls check it once

relaxatraja
Inspiring
August 23, 2011

You marked as answered. it solved?

Kenneth Kawamoto
Community Expert
Community Expert
August 22, 2011

You are changing the position of mcVideoControls but not changing the size. You need to resize it and reposition the buttons inside.

Inspiring
August 23, 2011

Can u help me pls..

Kenneth Kawamoto
Community Expert
Kenneth KawamotoCommunity ExpertCorrect answer
Community Expert
August 23, 2011

Normally you have a class for the video controller, and the class has a function to handle resize.