我已经创建了一个视频播放器,但需要添加一个按钮,当单击该按钮时,视频将进入全屏查看模式。我不想缩放舞台上的所有东西-只想缩放视频。我似乎找不到怎么做--我想这会很容易。
发布于 2009-09-22 13:37:09
看看这是否起作用:
stage.displayState = StageDisplayState.FULL_SCREEN;
videoPlayer.x = 0;
videoPlayer.y = 0;
//save the width and height in temp vars
//for restoring them later.
videoPlayer.width = stage.fullScreenWidth;
videoPlayer.height = stage.fullScreenHeight;发布于 2009-09-22 01:53:53
我的理解是,您只能将整个舞台设置为全屏,而不是选择性地设置元素,因为您正在有效地放大显示树根部的stage对象。实现所需效果的最佳方法是排列/隐藏/显示任何不希望在FullScreenEvent.FULL_SCREEN事件处理程序中可见的对象。
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/FullScreenEvent.html
此外,来自阶段文档的相关花边新闻,displayState section
全屏模式下影片的缩放行为由scaleMode设置(在Stage.scaleMode文件中使用Stage.scaleMode属性或SWF文件的embed标签设置)确定。如果在应用程序转换到全屏模式时将scaleMode属性设置为noScale,则会更新舞台的宽度和高度属性,并会更新舞台的resize事件。
发布于 2014-04-02 23:32:39
最近遇到了这个问题,而且效果很好。所以把它放在这里以防对任何人有帮助。
Flex客户端代码:
private function startFullScreen(event:MouseEvent):void
{
videoHolder.removeChild(vid); //videoHolder is an spark VideoDisplay
Component
this.stage.addChild(vid);
this.stage.displayState = StageDisplayState.FULL_SCREEN;
oldWidth = vid.width; //store old values required while going back
oldHeight = vid.height;
vid.width = this.stage.width;
vid.height = this.stage.height;
this.stage.addEventListener(FullScreenEvent.FULL_SCREEN,fullScreenHandler);
}
}
/* handler for Fullscreen */
private function fullScreenHandler(event:FullScreenEvent):void
{
//This function is called when user presses Esc key
//on returning to normal state, add the video back
if(!event.fullScreen)
{
this.stage.removeChild(vid);
videoHolder.addChild(vid);
vid.width = oldWidth;
vid.height = oldHeight;
this.stage.removeEventListener(FullScreenEvent.FULL_SCREEN,fullScreenHandler )
}
}https://stackoverflow.com/questions/1457318
复制相似问题