# Drawing lines in flash

**URL:** https://forum.kirupa.com/t/drawing-lines-in-flash/286597
**Category:** flash
**Created:** [April 17, 2009, 2:41pm UTC](https://forum.kirupa.com/t/drawing-lines-in-flash/286597 "2009-04-17T14:41:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![sebby64](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@sebby64](https://forum.kirupa.com/u/sebby64)
#### Post date: [April 17, 2009, 2:41pm UTC](https://forum.kirupa.com/t/drawing-lines-in-flash/286597/1 "2009-04-17T14:41:01Z")

</div>

Hello everyone,

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

```auto

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?
