开发者

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

开发者 https://www.devze.com 2023-03-28 19:47 出处:网络
I am playing a flv video using the videoplayer class of flex. (all the properties of it are being set at runtime)

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 开发者_如何学JAVApossible. If yes then how can I do this.?


Dispatch click event from the fullScreenButton of VideoPlayer.

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


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.


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

精彩评论

暂无评论...
验证码 换一张
取 消