AS3 convert drawing into jpeg

Im currently doing a drawing application using AS3…and I wanna put a function where u could convert the drawing into Jpeg format, I’ve been google around and found a few sample using PHP/Ming to do the work…but I couldnt understand the code at all, I was wondering if I could do it just by AS3???

here is the example i goggled using PHP/Ming

http://www.jerryscript.hostrocket.com/flash/draw/

Thanks,
Ron