我可以使用 FLVPlayback 和 flash 9.0.115+ 实现旧的全屏缩放吗?
-
01-07-2019 - |
题
对于以前版本的 Flash,进入全屏模式会将舞台的高度和宽度增加到屏幕的尺寸。现在硬件缩放已经到来,高度和宽度设置为视频的尺寸(如果宽高比不同,则加上边框)。
没关系,除非您对视频进行了控制。以前,你可以控制它们的大小;现在,你可以控制它们的大小。但现在它们被放大到与视频相同的比例,并且像素化得可怕。控件很丑陋,字幕也难以辨认。
用户可以关闭硬件缩放,但实现的只是关闭抗锯齿功能。控制装置仍然被炸得丑陋。
有没有办法恢复旧的缩放行为?
解决方案 2
我最终找到了答案。问题是FLVPlayback组件现在使用stage.fullScreenSourceRect属性进入硬件扩展的全屏模式。当它这样做时,它会拉伸stage.fullScreenSourceRect给出的渲染区域来填充屏幕,而不是增加舞台或任何组件的大小。
要停止它,你必须创建一个FLVPlayback的子类,它使用UIManager的子类,并覆盖设置stage.fullScreenSourceRect的函数。在不利方面,您将失去硬件扩展;但从好的方面来说,你的玩家看起来并不像是由一个三岁的蜡笔画出来的。
CustomFLVPlayback.as:
import fl.video.*;
use namespace flvplayback_internal;
public class CustomFLVPlayback
{
public function CustomFLVPlayback()
{
super();
uiMgr = new CustomUIManager(this);
}
}
CustomUIManager.as:
import fl.video.*;
import flash.display.StageDisplayState;
public class CustomUIManager
{
public function CustomUIManager(vc:FLVPlayback)
{
super(vc);
}
public override function enterFullScreenDisplayState():void
{
if (!_fullScreen && _vc.stage != null)
{
try
{
_vc.stage.displayState = StageDisplayState.FULL_SCREEN;
} catch (se:SecurityError) {
}
}
}
}
我们使用actionscript将FLVPlayback添加到我们的电影中,所以我们只需要替换
var myFLVPLayback:FLVPlayback = new FLVPlayback();
与
var myFLVPLayback:CustomFLVPlayback = new CustomFLVPlayback();
我不知道是否有办法在组件库中提供自定义类。
其他提示
这是解决它的另一种方法,它更简单,似乎对我来说效果很好。
<代码> 代码>
myFLVPlayback.fullScreenTakeOver = false;
fullScreenTakeOver
属性是在Flash Player 9 update 3 中引入的。文档有点模糊,但这里有更多信息:
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, onStageResize);
function onStageResize(event:Event):void {
//do whatever you want to re-position your controls and scale the video
// here's an example
myFLVPlayback.width = stage.stageWidth;
myFLVPlayback.height = stage.stageHeight - controls.height;
controls.y = stage.stageHeight - controls.height;
}
或者,我对此并不完全确定,你可能会尝试在FLVPlayback上做一些9切片缩放,但我不知道这是否有用。
9切片缩放教程: http://www.sephiroth.it/tutorials/ flashPHP / scale9 /