**Hello , I have been learning AS 2.0 för a week of two from now, but now I´m stuck…
It´s about inheritance and classes. I guess I just send the code and hope for someone to see what´s wrong…
First I have the “Mover.as” Class who is the parent:**
class Mover extends MovieClip {
var objectRef:Object;
var targetMC:MovieClip;
var xVel:Number;
var yVel:Number;
function Mover(targetMC:MovieClip, xVel:Number, yVel:Number) {
this.targetMC = target MC
this.targetMC.objectRef = this;
this.xVel = xVel;
this.yVel = yVel;
}
function updatePosition() {
this._x += this.objectRef.xVel;
this._y += this.objectRef.yVel;
}
function startMoving() {
this.targetMC.onEnterFrame = this.updatePosition;
}
function stopMoving() {
this.targetMC.onEnterFrame = null;
}
}
Then I have the “Bouncer” class who is to target the Mover Class in order to make the circle in the .fla file move and finally bounce, but the bouncing is left for later, for now I just need it to move =):
class Bouncer extends Mover {
function Bouncer(targetMC:MovieClip) {
super(targetMC, xVel, yVel);
}
function startMoving() {
trace(“startMoving function called in Bouncer class”);
super.startMoving();
}
}
Then of course the “Inheritance.fla” file, which has the script in the first frame and a circle symbol that has the instance name of “circle”:
var myMover:Mover = new Mover(circle, 2, 3);
I buy an icecream and eternal greatfulness for anyone who solves it
Thanks in advance, dudes , and good luck !