
30.03.2004, 17:51
|
|
Регистрация: Mar 2004
Адрес: Украина, Винница
Сообщений: 4
|
помогите разобраться с относительными и абсолютными путями
У меня есть скрип написаный в мувиклипе Angel вида :
onClipEvent (enterFrame) {
speed = 8;
Spot_x = _root._xmouse;
Spot_y = _root._ymouse;
delta_x = _x - Spot_x;
delta_y = _y - Spot_y;
targetRotation = -Math.atan2(delta_x, delta_y)/(Math.PI/180);
// move beetle toward the target and stop when it gets there
if (Math.sqrt((delta_x*delta_x)+(delta_y*delta_y))>(speed+4)) {
_y -= speed*Math.cos(targetRotation*(Math.PI/180));
_x += speed*Math.sin(targetRotation*(Math.PI/180));
};
play();
}
Я хочу записать все скрипты в первом фрейме головной сцены попробывал исправить пути в обработчиках на абсолютные. зделал это примерно так
запихнул в первый фрейм отдельного слоя головной сцены скрипт в таком виде
Angel.onEnterFrame = function {
speed = 8;
Spot_x = _root._xmouse;
Spot_y = _root._ymouse;
delta_x = Angel._x - Spot_x;
delta_y = Angel._y - Spot_y;
targetRotation = -Math.atan2(delta_x, delta_y)/(Math.PI/180);
// calculate the two methods of rotation
//
// move beetle toward the target and stop when it gets there
if (Math.sqrt((delta_x*delta_x)+(delta_y*delta_y))>(speed+4)) {
Angel._y -= speed*Math.cos(targetRotation*(Math.PI/180));
Angel._x += speed*Math.sin(targetRotation*(Math.PI/180));
};
play();
}
При попытке запустить ролик выдаётся ошибка
Scene=Scene 1, Layer=Layer 29, Frame=1: Line 1: Function name expected
Angel.onEnterFrame = function {
знаю ошибку допустил елементарную, но как прописывать абсолютные пути на обработчик нигде в книгах найти не могу, ПОМОГИТЕ ПОЖАЛУЙСТА или дайте ссылки на литературу !
Заранее спасибо
|