⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scaleutils.as

📁 使用as3.0重新写了播放器 播放器大小缩小,在21k左右 新参数和vcastr2.x不同 可以通过xml对播放器设置 界面更新 增加音量控制 留出了插件的接口
💻 AS
字号:
package com.ruochi.video {
	public class ScaleUtils {		
		import flash.display.DisplayObject;
		import flash.media.Video;
		public static const NO_SCALE:String = "noScale";
		public static const EXACT_FIT:String = "exactFit";
		public static const SHOW_ALL:String = "showAll";
		public static const NO_BORDER:String = "noBorder";
		public static function fillNoScale(video:Video, videoContainer:DisplayObject):void {
			video.width = video.videoWidth;
			video.height = video.videoHeight;
			video.x = Math.round((videoContainer.width -video.width) / 2);
			video.y = Math.round((videoContainer.height -video.height) / 2);
		}
		public static function fillExactFit(video:Video, videoContainer:DisplayObject):void {
			video.x = videoContainer.x;
			video.y = videoContainer.y;
			video.width = videoContainer.width;
			video.height = videoContainer.height;
		}
		public static function fillShowAll(video:Video, videoContainer:DisplayObject):void {
			var originW = video.videoWidth;
			var originH = video.videoHeight;
			if (originW/originH>videoContainer.width/videoContainer.height) {
				video.width = videoContainer.width;			
				video.height = Math.round(video.width / originW * originH);
			} else {
				video.height=videoContainer.height;
				video.width = Math.round(video.height / originH * originW);
			}
			video.x = Math.round((videoContainer.width -video.width) / 2);
			video.y = Math.round((videoContainer.height -video.height) / 2);
		}
		public static function fillNoBorder(video:Video, videoContainer:DisplayObject):void {
			var originW = video.videoWidth;
			var originH = video.height/video.scaleY;
			if (originW/originH>videoContainer.width/videoContainer.height) {
				video.height=videoContainer.height;
				video.width=video.height/originH*originW;
			} else {
				video.width=videoContainer.width;
				video.height=video.width/originW*originH;
			}
			video.x=(videoContainer.width-video.width)/2;
			video.y =(videoContainer.height-video.height)/2;
			video.x = Math.round((videoContainer.width -video.width) / 2);
			video.y = Math.round((videoContainer.height -video.height) / 2);
		}
	}	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -