You may want to have loader as a member variable so that you can access it in other contexts or make subsequent requests without using init()
private var loader:URLLoader; Also, you should set the loader.dataFormat to URLLoaderDataFormat.BINARY before loading binary data. See: http://livedocs.adobe.com/flex/3/langref/flash/net/URLLoader.html#dataFormat Finally, in the complete event, you can cast loader.data to a ByteArray: private function onComplete(e:Event):void { var byteArr:ByteArray = loader.data as ByteArray; // ... } Pete -----Original Message----- From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of gilbert_mizrahi Sent: Wednesday, March 18, 2009 11:22 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Where I can examples of how to use ByteArray I have searched everywhere and I can't find useful examples of how to use the ByteArray class and the Flex 3 documentation does not include much. I want to read and FLV file with ByteArray, but I don't know how. I tried: private function init():void { var request:URLRequest = new URLRequest("assets/street.flv"); var loader:URLLoader = new URLLoader(); try { loader.load(request); } catch (error:ArgumentError) { trace("An ArgumentError has occurred."); } catch (error:SecurityError) { trace("A SecurityError has occurred."); } loader.addEventListener(Event.COMPLETE, onComplete); } private function onComplete(e:Event):void { var byteArr:ByteArray = new ByteArray (); byteArr.readByte(); //???? trace("byteArr "+byteArr); } the ByteArray readByte method accept 0 parameters, so what should I do? ------------------------------------ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links