import mx.graphics.codec.JPEGEncoder;
private var file:FileReference = new FileReference();
var bitmapData:BitmapData = new BitmapData(pic.width, pic.height);
bitmapData.draw(pic,new Matrix());
var bitmap : Bitmap = new Bitmap(bitmapData);
var jpg:JPEGEncoder = new JPEGEncoder();
var ba:ByteArray = jpg.encode(bitmapData);
file.save(ba,"name.jpg");