Показать сообщение отдельно
Старый 20.06.2005, 19:21
Hanzo вне форума Посмотреть профиль Отправить личное сообщение для Hanzo Найти все сообщения от Hanzo
  № 1  
Ответить с цитированием
Hanzo

Регистрация: Jun 2005
Сообщений: 74
По умолчанию [AS2]помогите с определением метода

Код:
	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
И возвращал бы её.
Все просто вроде, но ругается, и это при создании объекта, функции эти я не вызываю.


Последний раз редактировалось Nirth; 20.06.2005 в 23:04.