# Clear the contents of a movie clip but still use it?

**URL:** <https://forum.kirupa.com/t/clear-the-contents-of-a-movie-clip-but-still-use-it/242746>\
**Category:** flash\
**Created:** [October 30, 2007, 12:29am UTC](https://forum.kirupa.com/t/clear-the-contents-of-a-movie-clip-but-still-use-it/242746 "2007-10-30T00:29:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![imvain2](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/imvain2/32/620_2.png) [@imvain2](https://forum.kirupa.com/u/imvain2)\
**Post date:** [October 30, 2007, 12:29am UTC](https://forum.kirupa.com/t/clear-the-contents-of-a-movie-clip-but-still-use-it/242746/1 "2007-10-30T00:29:29Z")

</div>

I have the code below, which essentially is the beginning of a personal physical computing project that will use an offline hardware to control the flash app like the an etch a sketch.

The code below, when the user hits the left, right, up down the cursor draws a line to that location. I want a reset button that essentially clears the line, and moves the cursor back to the middle of the screen. I have the ResetSketch() function that is suppose to clear the lines, but it doesn’t work.

```auto

_root.createEmptyMovieClip ("SketchMC", 1);
SketchMC.lineStyle (1, 0x000000, 100);
MoveSpce = 2;
Xpos = Stage.width/2;
Ypos = Stage.height/2;
SketchMC.moveTo (Xpos, Ypos);
MoveLine = false;

keyListener = new Object();
keyListener.onKeyDown = function() {
	//x = String.fromCharCode(Key.getAscii())
	if(Key.getCode() == Key.RIGHT){
		Xpos = Xpos + MoveSpce;
		MoveLine = true;
	}
	else if(Key.getCode() == Key.LEFT){
		Xpos = Xpos - MoveSpce;
		MoveLine = true;
	}
	else if(Key.getCode() == Key.UP){
		Ypos = Ypos - MoveSpce;
		MoveLine = true;
	}
	else if(Key.getCode() == Key.DOWN){
		Ypos = Ypos + MoveSpce;
		MoveLine = true;
	}
	if(MoveLine){
		SketchMC.lineTo (Xpos,Ypos);
		MoveLine = false;
	}
};
Key.addListener(keyListener);

function ResetSketch(){
	_root.SketchMC.removeMovieClip();
	_root.createEmptyMovieClip ("SketchMC", 1);
}

```
