I’m building a game in which I have different player objects which will behave differently. I want to make a player(i call it professor) class held in an external .as file. I need to be able to assign onEnterFrame attributes in for this class in the external .as file and I’m encountering some difficulties. here is my .as file
//professor constructor
_global.Professor = function ( skin, thrust, decay, maxSpeed )
{
this.skin = skin;
this.thrust = thrust;
this.decay = decay;
this.maxSpeed = maxSpeed;
};
Professor.prototype.getSkin = function() {
trace(this.skin);
};
Professor.prototype.onEnterFrame = function()
{
trace(“this should be repeating at set frame rate…”);
};
The constructor is working fine, along witht he getSkin function, but I can’t get the onEnterFrame function to work. It is my understanding that once I instantiate an instance of the Professor class that the onEnterFrame function should kick over and start sending my trace statement to the debugger at the current frame rate. It isn’t working though… Any ideas? Thanks.
ps. here is the code in my .fla
#include “Professor.as”
playerOne = new Professor(“mathews”);
playerOne.getSkin();