PDA

View Full Version : Overriding methods in child objects


uroboros
01-02-2001, 02:21 AM
(Flash 5)

I have an Entity object from which other objects inherit.

The PC object inherits from it.

Entities need to be able to update some of their variables, which is done by calling Entity's RefreshMe() method.

this.RefreshMe = _level0.RefreshMe;

is what the code looks like in the object. It works like a charm.

PCs have more data in them, so they need to refresh a bit more things than plain old Entities. In the PC object, I have this line:

this.RefreshMe = _level0.RefreshPC;

Trouble is, when I make a new PC,

Character = new PC();

and call

Character.RefreshMe();

Flash calls _level0.RefreshMe()!

What's going on here?

uroboros
01-02-2001, 02:33 AM
Hot damn, when I stopped trying to call the refreshing method in the object's constructor it started to work. Hooray.