# Draggable api lines

**URL:** <https://forum.kirupa.com/t/draggable-api-lines/193123>\
**Category:** Uncategorized\
**Created:** [July 4, 2006, 3:14pm UTC](https://forum.kirupa.com/t/draggable-api-lines/193123 "2006-07-04T15:14:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![540media](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/540media/32/2543_2.png) [@540media](https://forum.kirupa.com/u/540media)\
**Post date:** [July 4, 2006, 3:14pm UTC](https://forum.kirupa.com/t/draggable-api-lines/193123/1 "2006-07-04T15:14:07Z")

</div>

I wonder if anyone can help with this?

I’ve been trying to get draggable api lines to work, have pretty much got it 100% except for 1 problem. The idea is that the user needs to draw on the stage 3 lines (this is to create a graph) I have it where they can click then drag over the graph and a line appears. The problem comes when the user clicks and doesnt drag. This clicking registers a mouse down and moves onto the next line.  
So if the user were to click on the stage 3 times they are unable to draw any line until they click the reset button. While this isnt a major problem its something that I’d like to solve.

below is the code that is used to create one of the lines, everytime the users mouse is up \_global.i goes up 1 until it reaches 4 when they cant draw anymore.

```auto
onClipEvent(mouseDown){
    if (_global.i == 1){
        xStart = 50*Math.round(_xmouse/50);
        yStart = 50*Math.round(_ymouse/50);
        this.onMouseMove = function(){
            if (_global.i == 1){
                this.createEmptyMovieClip("line1", 1);
                this.line1.lineStyle(3, 0xff0000, 100);
                this.line1.moveTo(xStart, yStart);
                this.line1.lineTo(50*Math.round(_xmouse/50), 50*Math.round(_ymouse/50));
            }
        }
    }
}
onClipEvent(mouseUp){
    if (_global.i == 1){
        _global.line1Height = this.line1._height;
        _global.line1Width = this.line1._width;
        _global.line1xStart = xStart;
        _global.i = 2;
    }
}

```

I dont feel like I’ve explained this very well so I’ve attached the .fla as well
