<?xml version="1.0" encoding="utf-8"?> <tvWindow xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute" cornerRadius="7" title="Video Manager" width="800" height="620" creationComplete="doInit()" horizontalScrollPolicy="off" verticalScrollPolicy="off"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.controls.Alert; [Bindable] public var tvMaster:Master; [Bindable] private var videoList:ArrayCollection; [Bindable] private var artistsCol:ArrayCollection; [Bindable] private var vidInfo:ArrayCollection; [Bindable] private var tvUsers:ArrayCollection; private function doInit():void { var uArgs:Object = new Object; uArgs.gid = tvMaster.userInfo[0].gid; uArgs.uid = tvMaster.userInfo[0].uid; tvMaster.gateway.call("tuve.getUsers",new Responder(gotUsers,tvMaster.onFault),uArgs); uArgs = null; findVid(); } private function gotUsers(result:Array):void { if (result != null) tvUsers = new ArrayCollection(result); } public function findVid():void { var uArgs:Object = new Object; uArgs.gid = tvMaster.userInfo[0].gid; uArgs.uid = tvMaster.userInfo[0].uid; uArgs.skey = ""; tvMaster.gateway.call("tuve.getArtists",new Responder(gotArtists,tvMaster.onFault),uArgs); uArgs.skey = vidSearch.text; tvMaster.gateway.call("tuve.getVideos",new Responder(gotVideos,tvMaster.onFault),uArgs); uArgs = null; this.enabled = false; } public function getArtists():void { var uArgs:Object = new Object; uArgs.gid = tvMaster.userInfo[0].gid; uArgs.uid = tvMaster.userInfo[0].uid; uArgs.skey = ""; tvMaster.gateway.call("tuve.getArtists",new Responder(gotArtists,tvMaster.onFault),uArgs); uArgs = null; } private function gotArtists(result:Array):void { if (result != null) { artistsCol = new ArrayCollection(result); vidBio.dataProvider = artistsCol; } } private function gotVideos(result:Array):void { this.enabled = true; if (result != null) { if (videoList != null) videoList = null; videoList = new ArrayCollection(result); videoGrid.selectedIndex = 0; getVidData(); } } private function getVidData():void { tvMaster.gateway.call("tuve.getVideo",new Responder(gotVideo,tvMaster.onFault),videoGrid.selectedItem.vid); } private function gotVideo(result:Array):void { var i:Number; if (result != null) { vidInfo = new ArrayCollection(result); vidStatus.text = "Data Retrieved For: " + vidInfo[0].title; vidArtist.text = vidInfo[0].artist; vidTitle.text = vidInfo[0].title; vidGenre.text = vidInfo[0].genre; vidLength.text = vidInfo[0].length; //vidFile.text = vidInfo[0].file; if (vidInfo[0].description == "") vidDesc.htmlText = "No description available"; else vidDesc.htmlText = vidInfo[0].description; vidRes.text = vidInfo[0].width + "X" + vidInfo[0].height; genTime.text = vidInfo[0].thumbFrame; vidThumb.source = "http://www.ubixonline.com/images/" + vidInfo[0].thumb; for (i = 0;i< tvMaster.tvRating.length();i++) { if (tvMaster.tvRating[i].@data == vidInfo[0].rating) { vidRating.selectedIndex = i; break; } } for (i = 0;i< tvMaster.tvClass.length();i++) { if (tvMaster.tvClass[i].@data == vidInfo[0].classification) { vidClass.selectedIndex = i; break; } } for (i = 0;i < artistsCol.length;i++) { if (vidInfo[0].aid == artistsCol[i].aid) { vidBio.selectedIndex = i; break; } } for (i = 0;i < tvUsers.length;i++) { if (vidInfo[0].oid == tvUsers[i].uid) { vidOwner.selectedIndex = i; break; } } } } private function doUpdate():void { var newInfo:Object = new Object(); newInfo.genre = vidGenre.text; newInfo.artist = vidArtist.text; newInfo.title = vidTitle.text; newInfo.genre = vidGenre.text; newInfo.length = vidLength.text; newInfo.aid = vidBio.selectedItem.aid; newInfo.rating = vidRating.selectedItem.@data.toString(); newInfo.classification = vidClass.selectedItem.@data.toString(); newInfo.vid = vidInfo[0].vid; newInfo.thumbFrame = genTime.text; newInfo.description = vidDesc.htmlText; newInfo.oid = vidOwner.selectedItem.uid; tvMaster.gateway.call("tuve.updateVideo",new Responder(updateRes,tvMaster.onFault),newInfo); } private function updateRes(result:String):void { if (result == "0") vidStatus.text = "Updated"; else vidStatus.text = "Error Updating"; } private function doPrev():void { if (upOnChange.selected == true) doUpdate(); videoGrid.dispatchEvent(new KeyboardEvent(KeyboardEvent.KEY_DOWN,true,false,0.0,38)); } private function doNext():void { if (upOnChange.selected == true) doUpdate(); videoGrid.dispatchEvent(new KeyboardEvent(KeyboardEvent.KEY_DOWN,true,false,0.0,40)) } private function regenThumb():void { var data:Object = new Object(); data.file = vidInfo[0].file; data.time = genTime.text; data.vid = vidInfo[0].vid; tvMaster.gateway.call("tuve.regenThumb",new Responder(thumbDone,tvMaster.onFault),data); } private function thumbDone($thumb:String):void { if ($thumb != null) { vidStatus.text = "Thumb Generated"; vidThumb.source = "http://www.ubixonline.com/images/" + $thumb; } } ]]> </mx:Script> <mx:HBox width="100%" horizontalGap="0" height="100%"> <mx:Canvas width="100%" height="100%"> <mx:Label text="Status:" /> <mx:Label id="vidStatus" x="44" width="400"/> <mx:TabNavigator y="20" height="480" creationPolicy="all"> <mx:Canvas label="Video Info" height="100%"> <mx:Form width="100%" height="445"> <mx:FormItem label="Artist:"> <mx:TextInput width="350" id="vidArtist" /> </mx:FormItem> <mx:FormItem label="Bio:"> <mx:ComboBox id="vidBio" labelField="artist" width="350"></mx:ComboBox> </mx:FormItem> <mx:FormItem label="Title:"> <mx:TextInput width="350" id="vidTitle" /> </mx:FormItem> <mx:FormItem label="Genre:"> <mx:TextInput width="350" id="vidGenre" /> </mx:FormItem> <mx:FormItem label="Length:"> <mx:TextInput id="vidLength"/> </mx:FormItem> <mx:FormItem label="Rating:"> <mx:ComboBox dataProvider="{tvMaster.tvRating}" labelField="@label" width="200" id="vidRating" /> </mx:FormItem> <mx:FormItem label="Classification:"> <mx:ComboBox dataProvider="{tvMaster.tvClass}" labelField="@label" width="200" id="vidClass" /> </mx:FormItem> <mx:FormItem label="Resolution:"> <mx:TextInput id="vidRes"/> </mx:FormItem> <mx:FormItem label="Thumbnail:"> <mx:Image width="200" height="150" id="vidThumb" scaleContent="true" maintainAspectRatio="true"/> </mx:FormItem> <mx:FormItem label="Owner"> <mx:ComboBox dataProvider="{tvUsers}" labelField="username" width="200" id="vidOwner" /> </mx:FormItem> </mx:Form> <mx:Button x="10" y="420" label="Regen Thumb" click="regenThumb()" /> <mx:TextInput x="121" y="420" text="1" width="72" id="genTime" enter="regenThumb()" /> <mx:Label x="201" y="420" text="hh:mm:ss[.xxx]" width="100"/> </mx:Canvas> <mx:Canvas label="Video Description"> <mx:RichTextEditor id="vidDesc" width="100%" height="100%"/> </mx:Canvas> </mx:TabNavigator> <mx:Button label="Update" click="doUpdate()" y="508" x="10"/> <mx:Button label="Prev" click="doPrev()" x="10" y="533"/> <mx:Button label="Next" click="doNext()" x="71" y="533"/> <mx:CheckBox label="Update On Record Change" x="10" y="558" selected="true" id="upOnChange"/> </mx:Canvas> <mx:Canvas width="300" height="100%"> <mx:TextInput id="vidSearch" width="227" enter="findVid()" y="5"/> <mx:Button label="Search" x="235" click="findVid()" y="5"/> <mx:DataGrid y="30" id="videoGrid" dataProvider="{videoList}" width="300" height="100%" change="getVidData()" verticalScrollPolicy="on"> <mx:columns> <mx:DataGridColumn headerText="Artist" dataField="artist" width="150" /> <mx:DataGridColumn headerText="Title" dataField="title" /> </mx:columns> </mx:DataGrid> </mx:Canvas> </mx:HBox> </tvWindow>