
Код:
public function pl_addStat(stat:String, count:Number):Number {
this.stat -= count;
return this.stat;
}
public function pl_removeStat(stat, count):Number {
this.stat -= count;
return this.stat;
}
Ошыбка:
**Error** D:\My Art\game\player.as: Line 23: There is no property with the name 'stat'.
this.stat -= count;
**Error** D:\My Art\game\player.as: Line 24: There is no property with the name 'stat'.
return this.stat;
**Error** D:\My Art\game\player.as: Line 27: There is no property with the name 'stat'.
this.stat -= count;
**Error** D:\My Art\game\player.as: Line 28: There is no property with the name 'stat'.
return this.stat;
Total ActionScript Errors: 4 Reported Errors: 4
Мне нужен метод класса который принимал бы параметры:
1й. Имя переменной.
2й. Количество.
Изменял переменную класса с именем записаным в параметре stat
И возвращал бы её.
Все просто вроде, но ругается, и это при создании объекта, функции эти я не вызываю.