Drawing lines in flash

Hello everyone,

I’m trying to design an application where you can draw lines.
This is my code.



onMouseDown = function (){
    original_x = _root._xmouse
    original_y = _root._ymouse
    value_obtained = true
}
onMouseUp = function (){
        value_obtained = false
}


_root.onEnterFrame = function(){
    
    if(value_obtained){
        
            _root.createEmptyMovieClip ("line", 1);
            line.lineStyle (5, 0xFF00FF, 100);
            
            line.moveTo (original_x, original_y);
            line.lineTo (_root._xmouse, _root._ymouse);
            
        
    }
        
        
    
      
}   
      

value_obtained is true when you click the mouse, and is made false when the mouse is released. original_x and original_y are the coordinates for the point of the first click.

How can I make it so that each created line stays on the screen and is not remade?