Allowing user to save bitmap

I recently saw a drawing script that allowed the user to save his drawing on his own computer as a jpeg image. I would like to know if this is pure AS3, and if it is, how to do it. I had no idea this was even possible. Thanks.