# Can i do this with listener?

**URL:** <https://forum.kirupa.com/t/can-i-do-this-with-listener/187416>\
**Category:** Uncategorized\
**Created:** [April 29, 2006, 12:19am UTC](https://forum.kirupa.com/t/can-i-do-this-with-listener/187416 "2006-04-29T00:19:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TemeZ](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@TemeZ](https://forum.kirupa.com/u/TemeZ)\
**Post date:** [April 29, 2006, 12:19am UTC](https://forum.kirupa.com/t/can-i-do-this-with-listener/187416/1 "2006-04-29T00:19:30Z")

</div>

if have a prototype like this

```auto

MovieClip.prototype.moveToXY = function(xPos, yPos) {
	this.onEnterFrame = function() {
		difx = xPos-this._x;
		dify = yPos-this._y;
		if (Math.abs(difx)>1 || Math.abs(dify)>1) {
			this._x += difx/5;
			this._y += dify/5;
		} else {
			this._x = xPos;
			this._y = yPos;
			delete this.onEnterFrame;
                        // ready
		}
	};
};

```

can i track that “ready” state with listener? -\> when the object has moved to new place x,y -\> other function should start…

because i’ll use that prototype with many mc:s i can’t call the function in that prototype!

so, can somebody help me?
