[AS3]定义要缩放的矩形视频播放源代码实例
定义要缩放的矩形,然后设置 Stage.displayState 属性。有关详细信息,请参阅用于 Adobe Flash Platform 的 ActionScript 3.0 参考
定义要缩放的矩形,然后设置 Stage.displayState 属性。有关详细信息,请参阅用于 Adobe Flash Platform 的 ActionScript 3.0 参考。完整的示例(如下所示)添加了额外的代码,这些代码创建连接以及视频的 NetStream 对象,并开始播放该视频。
- package
- {
- import flash.net.NetConnection;
- import flash.net.NetStream;
- import flash.media.Video;
- import flash.display.StageDisplayState;
- import fl.controls.Button;
- import flash.display.Sprite;
- import flash.events.MouseEvent;
- import flash.events.FullScreenEvent;
- import flash.geom.Rectangle;
- public class FullScreenVideoExample extends Sprite
- {
- var fullScreenButton:Button = new Button();
- var video:Video = new Video();
- public function FullScreenVideoExample()
- {
- var videoConnection:NetConnection = new NetConnection();
- videoConnection.connect(null);
- var videoStream:NetStream = new NetStream(videoConnection);
- videoStream.client = this;
- addChild(video);
- video.attachNetStream(videoStream);
- videoStream.play("http://www.helpexamples.com/flash/video/water.flv");
- fullScreenButton.x = 100;
- fullScreenButton.y = 270;
- fullScreenButton.label = "Full Screen";
- addChild(fullScreenButton);
- fullScreenButton.addEventListener(MouseEvent.CLICK, fullScreenButtonHandler);
- }
- private function fullScreenButtonHandler(event:MouseEvent)
- {
- var screenRectangle:Rectangle = new Rectangle(video.x, video.y, video.width, video.height);
- stage.fullScreenSourceRect = screenRectangle;
- stage.displayState = StageDisplayState.FULL_SCREEN;
- }
- public function onMetaData(infoObject:Object):void
- {
- // stub for callback function
- }
- }
- }
热门文章推荐
- [HLS]做自己的m3u8点播系统使用HTTP Live Streaming(HLS技术)
- [FMS]FMS流媒体服务器配置与使用相关的介绍
- [AS3]什么是M3U8,与HTML5的区别是什么
- AS2.0 让flash自适应全屏,并且不自动缩放
- [AS3]as3.0的sound类常用技巧整理
- [AS3]as3与ByteArray详解、ByteArray介绍、ByteArray用法
- 关于RTMP,RTMPT,RTMPS,RTMPE,RTMPTE协议的介绍
- [JS]分享浏览器弹出窗口不被拦截JS示例