Тема: new math method
Показать сообщение отдельно
Старый 21.09.2004, 02:02
media вне форума Посмотреть профиль Отправить личное сообщение для media Найти все сообщения от media
  № 1  
media

Регистрация: May 2000
Сообщений: 35
Question new math method

Привет всем,

вот понадобилось добавить новые методы к math объекту.
взял пример с сайта макромедии:

http://www.macromedia.com/devnet/mx/flash/articles/about_objects.html

Код:
Math.randomBetween = function(a,b) {
 return (a + Math.floor(Math.random()*(b-a+1)));
} 


// returns a random number: 5,6,7,8,9 or 10
x = Math.randomBetween(5, 10);
выдает:
Код:
**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 1: There is no property with the name 'randomBetween'.
     Math.randomBetween = function(a,b) {

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 7: There is no method with the name 'randomBetween'.
     x = Math.randomBetween(5, 10); 

Total ActionScript Errors: 2 	 Reported Errors: 2
что здесь не так ??


Спасибо !