专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Flash

flash视频全屏的困难。该如何处理

发布时间:2011-06-27 19:58:21 文章来源:www.iduyao.cn 采编人员:星星草
flash视频全屏的困难。。
不同的电脑全屏的效果不一样,被截断了,附图,,谁能写个完整的视频全屏代码




stage.scaleMode=StageScaleMode.NO_BORDER ;
stage.align=StageAlign.TOP_LEFT;

function divfull(e:MouseEvent):void
{
  stage.displayState="fullScreen";
  flv.x=0;
  flv.y=0;
  flv.width = 视频层.width;
  flv.height = 视频层.height;
  全屏.visible=false;
}

这么写会导致视频裁剪,不过StageScaleMode设置了其他三种也一样达不到效果

------解决方案--------------------
stage.displayState=StageDisplayState.FULL_SCREEN;
stage.displayState= StageDisplayState.NORMAL;
------解决方案--------------------
全屏的话,会受所处容器限制的,我找找看啊,有再说!
------解决方案--------------------
scaleMode设置为noScale,按等比例对视频进行缩放。
------解决方案--------------------
参考一下吧:
JScript code
import flash.display.Sprite;
import flash.geom.Rectangle;
import flash.events.MouseEvent;

var videoHolder:Sprite = new Sprite();
this.addChild(videoHolder);
var video:Sprite = new Sprite();
video.graphics.beginFill(0x999999);
video.graphics.drawRoundRect(0,0,120,80,10,10);
video.graphics.endFill();
this.addChild(video);
var rectVideoHolder:Rectangle = new Rectangle();
changeRectVideoHolder();
function changeRectVideoHolder(e:MouseEvent = null):void{
    //随机生成视频窗口的大小,最小宽度200,最大宽度400,最小高度100,最大高度300
    rectVideoHolder.width = 200 + int(Math.random() * 200);
    rectVideoHolder.height = 100 + int(Math.random() * 200);
    //为看效果,画个背景
    videoHolder.graphics.clear();
    videoHolder.graphics.beginFill(0);
    videoHolder.graphics.drawRect(0,0,rectVideoHolder.width,rectVideoHolder.height);
    videoHolder.graphics.endFill();
    //视频窗口舞台居中
    videoHolder.x = ((this.stage.stageWidth - videoHolder.width) >> 1);
    videoHolder.y = ((this.stage.stageHeight - videoHolder.height) >> 1);
    
    //等比例缩放视频
    var zoom1:Number = videoHolder.width / videoHolder.height;
    var zoom2:Number = video.width / video.height;
    if(zoom1 > zoom2){
        video.height = videoHolder.height;
        video.width = video.height * zoom2;
    }else{
        video.width = videoHolder.width;
        video.height = video.width / zoom2;
    }
    //视频居中
    video.x = ((this.stage.stageWidth - video.width) >> 1);
    video.y = ((this.stage.stageHeight - video.height) >> 1);
}
this.stage.addEventListener(MouseEvent.CLICK,changeRectVideoHolder);

------解决方案--------------------
sorry,我多此一举了。
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: