How do I make a video full screen using actionscript in flex desktop application

你。 提交于 2020-01-07 07:47:21

问题


I am playing a flv video using the videoplayer class of flex. (all the properties of it are being set at runtime)

I want to make the video fullscreen without clicking on the fullscreen button i.e. through programming.

Is it possible. If yes then how can I do this.?


回答1:


Dispatch click event from the fullScreenButton of VideoPlayer.

yourplayer.fullScreenButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));



回答2:


Use the displayState property of the stage. You can access the stage as a variable on the Application class. So, conceptually, do this:

FlexGlobals.topLevelApplication.stage.displayState = StageDisplayState.FULL_SCREEN

run this code in an applicationComplete event handler on the main application tag to put your app into full screen mode after it is finished loading.




回答3:


You can remove the VideoDisplay from it's parent and then add it to the stage at full width & height. Reverse the process when exiting full screen.

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


来源:https://stackoverflow.com/questions/7107692/how-do-i-make-a-video-full-screen-using-actionscript-in-flex-desktop-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!