Ok the example that enpstudios lives here doesn´t exactly what I want. because I don´t want to load an image from a PC to the server. What I want is to load a drawing that a user do in the flash to a server. Finally I get it using sendToURL. The image loads correctly in the server,but I have one more problem, and is that I want a response if the draw loads correctly or if there was an error, and senToURL method haven´t any response. So I'm trying wiht URLLoader with this code:
But now nothing happens, no error is displayed and the drawing doesn't load.Code:private function guardarImg(e:MouseEvent):void { var canvasBmp:BitmapData = new BitmapData(606,516); canvasBmp.draw(canvas); var myEncoder:JPGEncoder = new JPGEncoder(100); var byteArray:ByteArray = myEncoder.encode(canvasBmp); canvasBmp.dispose(); var header:URLRequestHeader = new URLRequestHeader("Content-type","application/octet-stream"); var myDate:Date = new Date ; var timeNow:Number = myDate.getTime(); timeNow.toString(); var request:URLRequest = new URLRequest("savejpg.php?nombre=images/draw_" + myDate + ".jpg"); request.data = byteArray; request.method = URLRequestMethod.POST; var loader:URLLoader = new URLLoader(); loader.dataFormat = URLLoaderDataFormat.VARIABLES; try { loader.load(request); showSaveMessage(msg); } catch (e:Error) { showFailMessage(fmsg); } }
![]()




Reply With Quote