# Class and Method Issues

**URL:** <https://forum.kirupa.com/t/class-and-method-issues/127781>\
**Category:** Uncategorized\
**Created:** [November 6, 2004, 4:32am UTC](https://forum.kirupa.com/t/class-and-method-issues/127781 "2004-11-06T04:32:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghjr](https://avatars.discourse-cdn.com/v4/letter/g/dec6dc/32.png) [@ghjr](https://forum.kirupa.com/u/ghjr)\
**Post date:** [November 6, 2004, 4:32am UTC](https://forum.kirupa.com/t/class-and-method-issues/127781/1 "2004-11-06T04:32:53Z")

</div>

I’m pretty new to classes and OOP, but here it goes:

I have a class that is an extension of the movieclip class, and that has one method called **moveMan**.

Inside this method, I create an object (called **keyLift** ) that will serve as a key listener for whenever a key is released. When this happens I want the instance of this class to **gotoAndStop** at a certain frame. Trouble is, I can’t call **this.gotoAndStop(whatever)** because I guess this refers to the keyLift object. Here is the code:

```auto

function moveMan (moveX, moveY, charDirection) {
// some code that really doesn't matter
	keyLift = new Object();
	keyLift.onKeyUp = function () {
		this.isWalking=false;
		this.gotoAndStop(charDirection);
	};
	Key.addListener(keyLift);
}

```

As you can see, in the lines this.isWalking and this.gotoAndStop I want **this.** to point to the class instance and not the key listener. Hope that wasn’t too confusing, it’s 2:30am anyways, better get some sleep. :z:

Cheers!
