BitmapData save as JPG (without php)

I need to know if it is possible to save BitmapData object as external JPG via save as dialog. Of course this can be done with php script which will receive image pixels information and construct the file but I need to do it WITHOUT php and I need it in AS2.