Convert lines to fills with AS

Hello guys,

I’m making simple graphic editor, which allows user to draw a shape (with MovieClip.lineTo() method) and after that use this shape as a mask for another movie clip. Is it possible to convert my ‘lined’ shape to fill (but not just filling it with MovieClip.beginFill() and MovieClip.endFill() methods)?

I would highly appreciate your help. Thanks!