如何在as3中没有受影响的界面项目的情况下全屏放大视频?

时间:2015-03-19 05:52:59

标签: actionscript-3 fullscreen flvplayback

我有一个问题,我不知道如何纠正它。

我想在我的项目中全屏工作。但是当你点击控制面板上的按钮只显示一个按钮的视频时,整个屏幕的视频,我想显示屏幕的整个视频。

不知道我想帮助我的问题的解决方案。我在AS3中使用此代码:

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

示例:

https://drive.google.com/file/d/0B9BcYjTM8tPoMVVOQTJhUl84b3M/view?usp=sharing

说明性图片:

screen-capture

3 个答案:

答案 0 :(得分:0)

在html嵌入代码中添加<param name="allowFullScreen" value="true" />(2次)。

同时删除此代码stage.displayState = StageDisplayState.FULL_SCREEN;

仅在单击鼠标后才能使用。

如果您想要全屏使用其他按钮:

fullScreenButton.addEventListener(MouseEvent.MOUSE_DOWN, fullScreenListener);
function fullScreenListener(e:MouseEvent):void {
    if(stage.displayState == StageDisplayState.NORMAL)
        stage.displayState=StageDisplayState.FULL_SCREEN;
    else
        stage.displayState=StageDisplayState.NORMAL;
}

更多信息here

关闭FLVPlaybackComponent fullScreenTakeOver使用

myVideoPlayer.fullScreenTakeOver = false;

答案 1 :(得分:0)

使用FLVPlayback组件的全屏按钮无法执行您想要的操作,因为它与舞台的全屏模式有关。相反,您可以使用舞台中的另一个按钮来激活视频播放器的全屏模式。

以我使用两个按钮为例,第一个按钮全屏显示整个动画,第二个按钮全屏显示动画全屏显示模式:

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;
    }
})

您可以看到此代码有效here(我没有为我的视频播放器使用皮肤)。

当然,这只是一个向您展示您正在寻找的方式的示例,您必须根据您的特定需求进行改进和调整。

希望可以提供帮助。

答案 2 :(得分:0)

禁用缩放

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;

关闭fullScreenTakeOver

flv_playback.fullScreenTakeOver = false;

并进入全屏模式

flv_playback.enterFullScreenDisplayState();
相关问题