Código :
<?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="660" height="500"> <mx:Script> <![CDATA[ /*Obtenemos el codigo binario del archivo*/ public var str:String = ""; import flash.filesystem.FileStream; import flash.filesystem.File; import mx.controls.Alert; import flash.filesystem.*; import flash.utils.ByteArray; import flash.events.*; import flash.desktop.ClipboardFormats; import mx.rpc.events.*; import flash.net.*; private var file:File = new File(); private function browse():void { var fileFilters:Array = new Array(); fileFilters.push(new FileFilter("Videos", "*.avi;*.mpg;*.3gp;*.mp4")); fileFilters.push(new FileFilter("Imagenes", "*.jpg;*.gif")); file.addEventListener(Event.SELECT, selectHandler); file.browse(fileFilters); } private function selectHandler(event:Event):void { var bytes:ByteArray = new ByteArray(); var myFileStream:FileStream = null; myFileStream = new FileStream(); myFileStream.addEventListener(ProgressEvent.PROGRESS, progresssHandler); myFileStream.addEventListener(Event.COMPLETE, completed); myFileStream.openAsync(file, FileMode.READ); myFileStream.position = 0; var brss:String = ""; var brs:int = 0; function progresssHandler(event:Event):void { //examinar.enabled = false; video.text = "Leyendo...Se paciente"; if (myFileStream.bytesAvailable >= 0) { uploadProgress.setProgress(str.length, file.size); b1.text = "Cargados " + str.length + " de " + file.size+ "bytes"; str += myFileStream.readMultiByte(myFileStream.bytesAvailable, File.systemCharset); } } function completed(event:Event):void { b1.text = "Video cargado. ("+str.length +"/"+ file.size+"bytes)"; startUpload.enabled = false; video.text = file.name; taaataaa.text = String(str); } } ]]> </mx:Script> <mx:Form width="100%" height="100%" horizontalCenter="0" backgroundColor="#5189C2" backgroundAlpha="1.0" borderColor="#FFFFFF" cornerRadius="7" alpha="0.55" color="#FFFFFF" verticalCenter="0"> <mx:Panel title="Busca un video y subelo" paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10"> <mx:Form width="100%" height="100%"> <mx:FormItem label="Video:" width="287" height="118"> <mx:Text id="video" text="Ninguno"/> <mx:ProgressBar id="uploadProgress" label="" mode="manual" width="201" height="9"/> <mx:Text id="b1" width="226.43939" height="21.969696"/> <mx:ControlBar horizontalAlign="right" width="235" height="44.015152"> <mx:Button label="Examinar" click="browse()" id="examinar" enabled="true"/> <mx:Button id="startUpload" label="Subir a YouTube" click="" enabled="false"/> </mx:ControlBar> </mx:FormItem> </mx:Form> </mx:Panel> <mx:FormItem label="Datos en binario" id="taaa"> <mx:TextArea width="309" height="142" id="taaataaa"/> </mx:FormItem> </mx:Form> </mx:WindowedApplication>