Glad my blog entry helped. :-) You can use the as3 PNGEncoder or JPGEncoder libraries at http://code.google.com/p/as3corelib/ to do the image format conversion within the flex application. You can post it to a server using either remoting, web service, or http service. Remoting/AMF3 is fastest and easiest, but the other methods work well too. Remoting does not require any base64 conversion for the binary data; you can send it "across the wire" as is.
-Andy This is from a previous post I wrote here on flexcoders... If you are using AMF3 (RemoteObject), you can serialize binary data without any conversion. If you are trying a standard HTTP post, I would use a HTTPService with the method= "POST". Then you have to Base64 encode the binary data and attach it to the parameters of the http service. On the server side, you will need to decode the base64 encoded data back into binary. Example: <mx:HTTPService id="httpService" showBusyCursor="true" useProxy="false" method="POST" resultFormat="text" url="/BinaryData/cf/HTTPImageSave.cfm" result="onResult('Data Saved via mx:HTTPService')" fault="onFault(event)" /> private function base64Encode( data : ByteArray ) : String { var encoder : Base64Encoder = new Base64Encoder(); encoder.encodeBytes( data ); return encoder.flush(); } private function sendData() : void { var data : ByteArray = encoder.encode( myPngByteArray ); var params : Object = { data : base64Encode( data ) }; httpService.send( params ); } In ColdFusion, you can decode the base64 data simply by using the "toBinary" function. Other languages have similar functions as well. Just a FYI... using the JPG instead of PNG requires significantly less bandwidth & time to post the data to the server. Base64 encoding the data also increases the size of the data being transferred "across the wire". It is much more efficient to use a remoteObject method with JPG-compressed data. _____________________________________ Andrew Trice Cynergy Systems, Inc. http://www.cynergysystems.com Blog: http://www.cynergysystems.com/blogs/page/andrewtrice Email: [EMAIL PROTECTED] Office: 866-CYNERGY ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Paul Whitelock Sent: Wednesday, February 14, 2007 1:51 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Exporting Charts as Image Thanks Brendan! I was indeed looking in the Language Reference documents which is why I couldn't find anything. In the last section of the Andrew Trice tutorial he's doing pretty much what I'd like to do, but he doesn't supply the source. The piece that I think I need is how to handle the data sent from Flex on the ColdFusion side (i.e., how to create the JPG from a ByteArray sent from Flex). Has anyone seen any tutorials or documentation on this? Paul --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , "Brendan Meutzner" <[EMAIL PROTECTED]> wrote: > > Hey Paul, > > It's in there... just not shown in the Language Reference documents if > that's where you're looking... check out > > corelib\src\trunk\src\actionscript3\com\adobe\images > > Andrew Trice also has a tutorial on capturing UI to bitmap on his blog here: > > http://www.cynergysystems.com/blogs/page/andrewtrice?entry=flex_2_bitmap data_tricks_and <http://www.cynergysystems.com/blogs/page/andrewtrice?entry=flex_2_bitma pdata_tricks_and> > > > Brendan