Flex视频播放及其控制视频大小显示
发布时间:2020-12-15 05:00:32 所属栏目:百科 来源:网络整理
导读:?xml version="1.0" encoding="utf-8"?s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="completeHandler()"fx:Declarations!-- 将非可视元素
<?xml version="1.0" encoding="utf-8"?> <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="completeHandler()"> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> </fx:Declarations> <fx:Script> <![CDATA[ import com.esri.ags.layers.supportClasses.AttachmentInfo; import com.esri.events.BaseEvent; import mx.core.UIComponent; [Bindable] public var enterprise_name_label:String = ""; [Bindable] public var remarks_label:String = ""; [Bindable] public var url:String = ""; private var nc:NetConnection; private var ns:NetStream; private var video:Video; private var meta:Object; private var uic:UIComponent; private function init():void { // view.removeAllChildren(); if(ns != null){ ns.pause(); ns = null; } var nsClient:Object = {}; nsClient.onMetaData = ns_onMetaData; nsClient.onCuePoint = ns_onCuePoint; nc = new NetConnection(); nc.connect(null); ns = new NetStream(nc); ns.play("assets/images/20120507_120410.mp4"); ns.client = nsClient; video = new Video(); video.attachNetStream(ns); uic = new UIComponent(); uic.addChild(video); view.addChild(uic); } private function ns_onMetaData(item:Object):void { trace("meta"); meta = item; // Resize Video object to same size as meta data. video.width = 300; video.height = 200; // Resize UIComponent to same size as Video object. uic.width = video.width; uic.height = video.height; } private function ns_onCuePoint(item:Object):void { trace("cue"); } private function completeHandler():void{ BaseEvent.addListener(BaseEvent.ATTACHMENTINFO,setimageHandler); BaseEvent.addListener(BaseEvent.VIDEO_STOP,cancelHandler); } private function setimageHandler(event:BaseEvent):void{ if(ns != null){ ns.pause(); ns = null; } view.removeAllChildren(); var img:Image = new Image(); img.source = (event.data as AttachmentInfo).url; img.visible = true; img.width = 200; img.height =100; view.addChild(img); } private function cancelHandler(event:BaseEvent):void{ if(ns != null){ ns.pause(); ns = null; } } ]]> </fx:Script> <s:Rect top="0" bottom="0" left="0" right="0"> <s:fill> <s:SolidColor color="0xf0f0f0"/> </s:fill> </s:Rect> <mx:Form width="100%" height="100%"> <mx:FormItem label="备注:" horizontalAlign="right"> <s:Label text="{remarks_label}" id="remarks"/> </mx:FormItem> <mx:FormItem label="附件:" horizontalAlign="right"> <mx:HBox id="hboximg" width="100%" height="100%" maxWidth="200"> </mx:HBox> <mx:HBox id="hboxvedio" width="100%" height="100%" maxWidth="200"> <s:Image id="img1" source="assets/images/movie.png" click="init()"/> </mx:HBox> </mx:FormItem> <mx:FormItem horizontalAlign="right"> <mx:HBox id="view" width="100%" height="100%"> </mx:HBox> </mx:FormItem> </mx:Form> </s:Group> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- S6E2H 系列烧录算法
- ruby-on-rails – Ruby on Rails教程混淆了Params hash的工
- React Native开发(二)
- [转自Oracle官方博客]一次服务器时间调整引发的实例宕机
- Oracle执行存储过程报错——ora-01031:权限不足
- Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Ca
- swift – 有没有办法测试Array的类型是否是可选的?
- Postgresql Hot_Standby 流复制 基于Linux 对postgresql 和
- 配置React的Babel 6和Webpack 2环境
- Flex AdvancedDataGrid – 删除排序箭头
推荐文章
站长推荐
热点阅读