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:
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!