如何在flex桌面应用程序中使用actionscript制作视频全屏
问题描述:
我使用flex的videoplayer类播放flv视频。 (它的所有属性都是在运行时设置的)如何在flex桌面应用程序中使用actionscript制作视频全屏
我想在不点击全屏按钮的情况下制作视频全屏,即通过编程。
这是可能的。如果是的话,我该怎么做。?
答
使用舞台的displayState属性。您可以在Application类上以变量的形式访问该阶段。在主应用程序标签的applicationComplete事件处理
FlexGlobals.topLevelApplication.stage.displayState = StageDisplayState.FULL_SCREEN
运行这段代码把你的应用程序进入全屏模式被加载完成后:那么,在概念上,做到这一点。
答
从VideoPlayer的fullScreenButton派发点击事件。
yourplayer.fullScreenButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
答
可以删除的VideoDisplay从它的父,然后在全宽&高度添加到舞台上。退出全屏时反转该过程。
protected function fullScreenBtn_clickHandler(event:MouseEvent):void
{
videoContainer.removeChild(videoDisplay)
this.stage.addChild(videoDisplay);
this.stage.displayState = StageDisplayState.FULL_SCREEN;
videoDisplay.width = stage.width;
videoDisplay.height = stage.height;
this.stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullScreenHandler);
}
protected function fullScreenHandler(event:FullScreenEvent):void
{
if(!event.fullScreen)
{
this.stage.removeChild(videoDisplay);
this.videoContainer.addChild(videoDisplay);
videoDisplay.percentHeight = videoDisplay.percentWidth = 100;
this.stage.removeEventListener(FullScreenEvent.FULL_SCREEN, fullScreenHandler);
}
}
感谢您的回复,但我试图让我的录像机切换到全屏默认运行状态。我正在使用flex 4 videoplayer类 –
@Gaurav Sharma为什么我的回答不会告诉你如何去做?你有没有尝试过,并有问题?如果是这样,问题是什么。 – JeffryHouser