我使用flex的videoplayer類播放flv視頻。 (它的所有屬性都是在運行時設置的)如何在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