# Path Movement

**URL:** <https://forum.kirupa.com/t/path-movement/311853>\
**Category:** flash\
**Created:** [July 18, 2010, 9:32pm UTC](https://forum.kirupa.com/t/path-movement/311853 "2010-07-18T21:32:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zerdang](https://avatars.discourse-cdn.com/v4/letter/z/ecb155/32.png) [@zerdang](https://forum.kirupa.com/u/zerdang)\
**Post date:** [July 18, 2010, 9:32pm UTC](https://forum.kirupa.com/t/path-movement/311853/1 "2010-07-18T21:32:18Z")

</div>

So I’ve created a script where a mc is clicked on and the player can draw a path using the mouse. I’m trying to figure out how I can get the mc to follow the path drawn out by the player’s mouse and when the player clicks again, it erases all of the path

my code is below

```auto
import flash.display.Sprite;
import flash.events.MouseEvent;

var clip:Shape = new Shape()
addChild(clip);

var mouse:Sprite = new Sprite
addChild(mouse);

ship1.addEventListener(MouseEvent.MOUSE_DOWN, activate);

function activate (evt:MouseEvent) {
	stage.addEventListener(MouseEvent.MOUSE_MOVE, drawLine);
}

function drawLine(evt:MouseEvent)
{

clip.graphics.moveTo(mouse.x, mouse.y);
clip.graphics.lineTo(mouseX, mouseY);
clip.graphics.lineStyle(2, 0xff9933);
mouse.x = mouseX
mouse.y = mouseY
}

```
