Search code examples
actionscript-3fullscreenflvplayback

How can I enlarge video fullscreen without the affected interface project in as3?


I have a problem I do not know how to correct it.

I want to work a full-screen in my project. But the video of the entire screen, and I want to show the entire video of the screen appears when you click the button on the control panel only video of a button.

Do not know the solution to the problem I want to help me. I USE this code in AS3:

stage.displayState = StageDisplayState.FULL_SCREEN;
stage.scaleMode = StageScaleMode.NO_SCALE;

Example:

Illustrative image:

screen-capture


Solution

  • You can not do what you want using the full-screen button of the FLVPlayback component because it's related to the full-screen mode of the stage. Instead, you can use another button in your stage to activate the full-screen mode of your video player.

    Take this example where I used two buttons, 1st button to full-screen the whole animation and the 2nd one to full-screen the video when the animation is on full-screen display mode :

    stage.scaleMode = StageScaleMode.NO_SCALE;
    stage.addEventListener(FullScreenEvent.FULL_SCREEN, function(e:FullScreenEvent){
        // disable the full-screen mode of the FLVPlayback component everytime the stage leaves the full-screen mode
        if(!e.fullScreen){
            player.fullScreenTakeOver = false;
        }
    })
    
    // player is my FLVPlayback component
    
    // activate video smoothing (option)
    player.getVideoPlayer(0).smoothing = true;
    
    // disable the full-screen mode of the FLVPlayback component
    player.fullScreenTakeOver = false;
    
    // this button is to activate the full-screen mode of the FLVPlayback component
    btn_player_fullscreen.addEventListener(MouseEvent.CLICK, function(e:MouseEvent){
        // if our stage is on fullscreen mode
        if(stage.displayState == StageDisplayState.FULL_SCREEN){
            // activate the full-screen mode of the FLVPlayback component
            player.fullScreenTakeOver = true;
        }
    })
    
    // this button is to activate the full-screen mode of the stage
    btn_fullscreen.addEventListener(MouseEvent.CLICK, function(e:MouseEvent){
        if(stage.displayState != StageDisplayState.FULL_SCREEN){
            stage.displayState = StageDisplayState.FULL_SCREEN;
        }
    })
    

    You can see this code working here ( I didn't use a skin for my video player ).

    Of course, this is just an example to show you a manner to do what you are looking for, you have to improve and adapt it to your specific needs.

    Hope that can help.