How to save MovieClip using Flash+AS3+PHP

For example, I have a MovieClip that I can draw on. Next, I need to save the drawn image to .jpg or .bmp, it doesn’t matter.
How to do it?
It is not clear how you can make an image out of a movie.
I’m new to AS3 and the classes are huge.
If you somehow make an image out of the movie, you can transfer it to the server with the FileReference class, and there you can already save it with a php script.

Answer 1, authority 100%

Creating a bitmap based on a visual object, movie, sprite, graphics, that’s not the point

var b:BitmapData = new BitmapData(100, 100, true, 0x0);
var bitmap:Bitmap = new Bitmap(b);

save to server

var jpgSource:BitmapData = new BitmapData (sketch_mc.width, sketch_mc.height);
var jpgEncoder:JPGEncoder = new JPGEncoder(85);
var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);
var header:URLRequestHeader = new URLRequestHeader("Content-type", "application/octet-stream");
var jpgURLRequest:URLRequest = new URLRequest("jpg_encoder_download.php?name=sketch.jpg");
jpgURLRequest.method = URLRequestMethod.POST; = jpgStream;
navigateToURL(jpgURLRequest, "_blank");

Google was heavily used, based on queries

adobe actionscript 3.0 save bitmap

adobe actionscript 3.0 bitmap from

second example uses lib –