You could then create a URLRequest object, which specifies the POST URL and the byte array of image data you want to send. (See http://livedocs.adobe.com/flex/3/langref/flash/net/URLRequest.html#data).Youcan then pass the URLRequest object to a URLLoader to do the actual sending/loading etc.
Tim On Fri, Mar 5, 2010 at 8:50 AM, Wally Kolcz <wko...@isavepets.com> wrote: > > > I have this so far. Where I have the ?? is where I would like to know a way > to either transfer the newly created image to a folder on the server...or I > am at the point I could just let them download it/save it and then reupload > it (dont prefer that). > > public function saveImage():void { > var bitmapData:BitmapData = new BitmapData(canvas.width, > canvas.height); > var rightNow:Date = new Date(); > bitmapData.draw(canvas,new Matrix()); > var bitmap : Bitmap = new Bitmap(bitmapData); > var jpg:JPEGEncoder = new JPEGEncoder(); > var ba:ByteArray = jpg.encode(bitmapData); > ??(UserDataModel.getInstance().person.username + '-' + rightNow + > '.jpg'); > > Alert.show("Your image has been saved and is in your photo > gallery", "Image Saved"); > > } > > On 3/5/2010 10:21 AM, Michael wrote: > > > > In order to save the image file to disk, you need to use the AIR File API, > which is available only to AIR applications. > > You can capture the image, encode it as PNG or JPEG using > mx.graphics.codec.JPEGEncoder or mx.graphics.codec.PNGEncoder, then upload > the resulting byte to a server. Then your server application can save the > file to disk on the server. > > I found these two links helpful: > > > http://stackoverflow.com/questions/780018/in-flex-how-do-i-create-populate-and-display-a-bitmap > > > http://blog.everythingflex.com/2008/02/25/create-images-with-air-and-jpegencoder/ > > Hope this helps, > Michael Portuesi > > --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>, Wally > Kolcz <wko...@...> <wko...@...> wrote: > > > > Can someone point me to an example of using the BitmapData.draw() to > > capture an image of a container on the screen and save it to the > > harddisk of the server. I see some that show me how to capture and > > process the image, but the saving it to the server is a mystery. > > > > I want my kids to be able to save their drawings/colorings to the web > > site art gallery. Thanks! > > > > > >