Ok, I have a class called Ship that includes all the data I need for my Movieclips…and I also have a class called Pilot that contains a variable of type Ship. I have a button that creates a movieclip like this:
attachMovie("basic_ship", "player_ship", 10000);
var Player:Pilot = new Pilot(Name_Input.text, 0, 150, player_ship);
Player.Get_Ship()._x = 100;
Player.Get_Ship()._y = 100;
Player.Get_Ship().onEnterFrame = function () {
if(Key.isDown(Key.UP) && !Key.isDown(Key.DOWN)) {
this.Change_Cur_Speed(0.01*this.Get_Max_Speed());
} else if(Key.isDown(Key.DOWN) && !Key.isDown(Key.UP)) {
this.Change_Cur_Speed(-0.01*this.Get_Max_Speed());
}
if(Key.isDown(Key.LEFT) && !Key.isDown(Key.RIGHT)) {
this._rotation += (this.Get_Max_Speed()/2);
} else if(Key.isDown(Key.RIGHT) && !Key.isDown(Key.LEFT)) {
this._rotation -= (this.Get_Max_Speed()/2);
}
this._x += this.Get_Cur_Speed()*Math.sin(this._rotation);
this._y += this.Get_Cur_Speed()*Math.cos(this._rotation);
}
The modification of the Ship’s ._x and ._y works fine…but the modification of the onEnterFrame() doesn’t work…is there something that I am doing wrong?