# Stepmania / DDR

**URL:** <https://forum.kirupa.com/t/stepmania-ddr/250125>\
**Category:** programming\
**Created:** [January 25, 2008, 8:26pm UTC](https://forum.kirupa.com/t/stepmania-ddr/250125 "2008-01-25T20:26:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jnsjohansson](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@jnsjohansson](https://forum.kirupa.com/u/jnsjohansson)\
**Post date:** [January 25, 2008, 8:26pm UTC](https://forum.kirupa.com/t/stepmania-ddr/250125/1 "2008-01-25T20:26:43Z")

</div>

Hi! Some months ago I used some example from a book, recreated it and created a Stepmania-replica.

It should’nt be that hard, and it isn’t since I managed it in AS2, can’t in AS3 though (I’m remaking it in AS3 to learn…).

```auto

clip.addEventListener(Event.ENTER_FRAME, initiate);

function initiate(e:Event):void {
	var currentTime:int = getTimer();
	var elapsedTime:int = currentTime - startTime;
	if(elapsedTime >= pauseTime) {
		var whatStep = routine[stepCount];
		var step:Step = new Step();
		step.y = 400;
		step.name = "step" + count;
		step.gotoAndStop(whatStep);
		clip.addChild(step);
		if(stepCount >= routine.length) {
			stepCount = 0;
		}
		stepCount++;
		count++;
		startTime = getTimer();
		step.addEventListener(Event.ENTER_FRAME, checkStep);
	}
}

function checkStep(e:Event) {
	var target = e.target;
	target.y = target.y - 4;
	if(target.y <= 200) {
		clip.removeChild(target);
	}
}

```

First I check my “clip” (Empty MovieClip put on Stage) with an ENTER\_FRAME. I have a pause-time on 1000 so every 1000 It creates a new arrow. So far so good.

Then my problem comes, I want to send the arrow upwards so I set for the “step” and ENTER\_FRAME aswell. This also works well but I want to remove the clip after it passes a certain value. I did the removeChild but get’s the error “The supplied DisplayObject must be a child of the caller.”.

I kinda understand the error but can’t figure out how the logic behind the game really should be set up.

Any pointer would be great, or direct comments. 🙂
