I need to convert MovieClip to ByteArray and send it to php using the POST method. The person handling php says that only ByteArray needs to be sent, and conversion to JPG and PNG can be done from the PHP side. When I built the option to save to the local computer, the following steps were used.
- Convert to Bitmapdata li>
- Using JPGEncoder and PNGEncoder in bitmaps
- Then, resorting to the byte variable of the array.
So, in this case, different byte arrays were used to save in the case of JPG and PNG, and it worked.
I found code to convert movieclip to bytearray in Stackoverflow itself
AS3: export MovieClip or Canvas to swf
var buffer:ByteArray = new ByteArray(); buffer.writeObject(MOVIE_CLIP_HERE); buffer.position = 0; buffer.writeBytes(...);
What should be the parameter of the writeBytes function of the buffer object. Suppose the movie clip name is canvas_mc.
I already figured out the php part. Thank you in advance.
source share