Please file a bug at bugs.adobe.com/jira so we can see if we can squeeze loadBytes onto SWFLoader before 3.0 closes down.
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin Sent: Friday, November 02, 2007 3:10 PM To: [email protected] Subject: Re: [flexcoders] Convert ByteArray to Bitmap Thanks for all your help on this. To answer your question Alex, no we are not using JPEGEncoder in our app, that was just to do a test that could easily get us the ByteArray data that we know is a valid image. I will try the listener approach. I guess I thought that wouldn't be needed since the data is already loaded. Regardless, to get it working in the meantime we sent everything thing back from the server as base64 encoded. We then used a Base64Image class (which extends Image) to display the image. http://flexlib.googlecode.com/svn/trunk/src/flexlib/controls/Base64Image .as <http://flexlib.googlecode.com/svn/trunk/src/flexlib/controls/Base64Imag e.as> (You will see it uses the same approach as yours to load the ByteArray) It works very well and makes me think that it could be a model for extending the Image component to receive a ByteArray as a source. It really should be that easy! Thanks for your thoughts. - Kevin On Nov 2, 2007, at 12:22 PM, Jim Hayes wrote: Yes, that would be nice! For what I've been doing a synchronous "convertToBitmapData(bytes:ByteArray):BitmapData" would be really nice as well. If only because using a "loader" seems a bit "wrong" when you've already loaded (or otherwise have) a byteArray. I have to admit that I've not actually checked the source code to see if I could find/copy that kind of function, however, since I do now have everything working with loader. Thanks Alex! Jim. -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Alex Harui Sent: 02 November 2007 16:05 To: [email protected] Subject: RE: [flexcoders] Convert ByteArray to Bitmap Yeah, things are "working", but really there should be a loadBytes() API on mx:Image/SWFLoader to save you a step. ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Jim Hayes Sent: Friday, November 02, 2007 3:16 AM To: [email protected] Subject: RE: [flexcoders] Convert ByteArray to Bitmap Oops, sorry, this one makes slightly more sense (first thing in the morning, not even finished my first cuppa...) private var _ldr:Loader private function myTest():void{ //get ByteArray from Image Component content var testBM:Bitmap = testImg.content as Bitmap; var myByte:ByteArray = new JPEGEncoder().encode(testBM.bitmapData); _ldr = new Loader(); _ldr.contentLoaderInfo.addEventListener(Event.COMPLETE,bitmapLoaded); _ldr.loadBytes(myByte); } private function bitmapLoaded(event:Event) { _ldr.removeEventListener(Event.COMPLETE,bitmapLoaded) //reset source myImage.source = _ldr.content; } . <http://geo.yahoo.com/serv?s=97359714/grpId=12286167/grpspId=1705007207/ msgId=92581/stime=1193998266/nc1=4507179/nc2=3848642/nc3=5008826> ______________________________________________________________________ This communication is from Primal Pictures Ltd., a company registered inEngland and Wales with registration No. 02622298 and registered office: 4th Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA,UK. VAT registration No. 648874577. This e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error, please contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 1010. Please then delete the e-mail and do not disclose its contents to any person. This email has been scanned for Primal Pictures by the MessageLabs Email Security System. ______________________________________________________________________ ______________________________________________________________________ This communication is from Primal Pictures Ltd., a company registered in England and Wales with registration No. 02622298 and registered office: 4th Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT registration No. 648874577. This e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error, please contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 1010. Please then delete the e-mail and do not disclose its contents to any person. This email has been scanned for Primal Pictures by the MessageLabs Email Security System. ______________________________________________________________________

