PDA

Просмотр полной версии : Частично не работают обработчики событий для Movie Clip


Тимофеев Михаил
03.01.2009, 14:29
Привет всем. Я очень прошу у вас помощи. У меня почему-то на одной сцене обработчики событий для мувиков работают, а на других сценах нет, хотя код напечатал по тем же правилам, как и в первой сцене. Вот часть кода:
var num1num = 0;
num2num = 0;
num3num = 0;
num4num = 0;
num5num = 0;
stop();
testtrue._visible = false;
testfalse._visible = false;
num1.onRollOver = function() {
m2.start(0, 1);
if (num1num == 0) {
num1.gotoAndStop(2);
} else {
num1.gotoAndStop(5);
}
};
num1.onRollOut = function() {
if (num1num == 0) {
num1.gotoAnsStop(1);
} else {
num1.gotoAndStop(4);
}
};
num1.onPress = function() {
m3.start(0, 1);
if (num1num == 0) {
num1.gotoAndStop(3);
} else {
num1.gotoAndStop(6);
}
};
num1.onRelease = function() {
if (num1num == 0) {
num1.gotoAndStop(5);
num1num = 1;
answer = 1;
num2.gotoAndStop(1);
num3.gotoAndStop(1);
num4.gotoAndStop(1);
num5.gotoAndStop(1);
num2num = 0;
num3num = 0;
num4num = 0;
num5num = 0;
} else {
num1.gotoAndStop(2);
num1num = 0;
answer = 0;
}
};
num1.onReleaseOutside = function() {
if (num1num == 0) {
num1.gotoAndStop(1);
} else {
num1.gotoAndStop(4);
}
};
num2.onRollOver = function() {
m2.start(0, 1);
if (num2num == 0) {
num2.gotoAndStop(2);
} else {
num2.gotoAndStop(5);
}
};
num2.onRollOut = function() {
if (num2num == 0) {
num2.gotoAnsStop(1);
} else {
num2.gotoAndStop(4);
}
};
num2.onPress = function() {
m3.start(0, 1);
if (num2num == 0) {
num2.gotoAndStop(3);
} else {
num2.gotoAndStop(6);
}
};
num2.onRelease = function() {
if (num2num == 0) {
num2.gotoAndStop(5);
num2num = 1;
answer = 2;
num1.gotoAndStop(1);
num3.gotoAndStop(1);
num4.gotoAndStop(1);
num5.gotoAndStop(1);
num1num = 0;
num3num = 0;
num4num = 0;
num5num = 0;
} else {
num2.gotoAndStop(2);
num2num = 0;
answer = 0;
}
};
num2.onReleaseOutside = function() {
if (num2num == 0) {
num2.gotoAndStop(1);
} else {
num2.gotoAndStop(4);
}
};
num3.onRollOver = function() {
m2.start(0, 1);
if (num3num == 0) {
num3.gotoAndStop(2);
} else {
num3.gotoAndStop(5);
}
};
num3.onRollOut = function() {
if (num3num == 0) {
num3.gotoAnsStop(1);
} else {
num3.gotoAndStop(4);
}
};
num3.onPress = function() {
m3.start(0, 1);
if (num3num == 0) {
num3.gotoAndStop(3);
} else {
num3.gotoAndStop(6);
}
};
num3.onRelease = function() {
if (num3num == 0) {
num3.gotoAndStop(5);
num3num = 1;
answer = 3;
num1.gotoAndStop(1);
num2.gotoAndStop(1);
num4.gotoAndStop(1);
num5.gotoAndStop(1);
num1num = 0;
num2num = 0;
num4num = 0;
num5num = 0;
} else {
num3.gotoAndStop(2);
num3num = 0;
answer = 0;
}
};
num3.onReleaseOutside = function() {
if (num3num == 0) {
num3.gotoAndStop(1);
} else {
num3.gotoAndStop(4);
}
};
num4.onRollOver = function() {
m2.start(0, 1);
if (num4num == 0) {
num4.gotoAndStop(2);
} else {
num4.gotoAndStop(5);
}
};
num4.onRollOut = function() {
if (num4num == 0) {
num4.gotoAnsStop(1);
} else {
num4.gotoAndStop(4);
}
};
num4.onPress = function() {
m3.start(0, 1);
if (num4num == 0) {
num4.gotoAndStop(3);
} else {
num4.gotoAndStop(6);
}
};
num4.onRelease = function() {
if (num4num == 0) {
num4.gotoAndStop(5);
num4num = 1;
answer = 4;
num1.gotoAndStop(1);
num2.gotoAndStop(1);
num3.gotoAndStop(1);
num5.gotoAndStop(1);
num1num = 0;
num2num = 0;
num3num = 0;
num5num = 0;
} else {
num4.gotoAndStop(2);
num4num = 0;
answer = 0;
}
};
num4.onReleaseOutside = function() {
if (num4num == 0) {
num4.gotoAndStop(1);
} else {
num4.gotoAndStop(4);
}
};
num5.onRollOver = function() {
m2.start(0, 1);
if (num5num == 0) {
num5.gotoAndStop(2);
} else {
num5.gotoAndStop(5);
}
};
num5.onRollOut = function() {
if (num5num == 0) {
num5.gotoAnsStop(1);
} else {
num5.gotoAndStop(4);
}
};
num5.onPress = function() {
m3.start(0, 1);
if (num5num == 0) {
num5.gotoAndStop(3);
} else {
num5.gotoAndStop(6);
}
};
num5.onRelease = function() {
if (num5num == 0) {
num5.gotoAndStop(5);
num5num = 1;
answer = 5;
num1.gotoAndStop(1);
num2.gotoAndStop(1);
num3.gotoAndStop(1);
num4.gotoAndStop(1);
num1num = 0;
num2num = 0;
num3num = 0;
num4num = 0;
} else {
num5.gotoAndStop(2);
num5num = 0;
answer = 0;
}
};
num5.onReleaseOutside = function() {
if (num5num == 0) {
num5.gotoAndStop(1);
} else {
num5.gotoAndStop(4);
}
};

Сцена представляет из себя тест лист, где нужно выделить правильный ответ. На мой взляд в написании обработчиков нет ошибок, но они никак не работают. При навередении на мувик не происходит никакого действия. Все мувики подписаны именами num1,num2...

rty
03.01.2009, 14:40
а вы не пробовали проверять работоспособность кода по частям? С одним мувиклипом.

Тимофеев Михаил
04.01.2009, 18:17
Пробовал, но никакого положительного результата. Дело в том, что на другой сцене, в том же документе, был применен подобный код для двух мувиков:
mu.onRollOver = function() {
m2.start(0, 1);
curs.gotoAndStop(2);
prompt.message1 = "Вкл./Выкл.";
prompt.play();
promptopen = 1;
};
mu.onRollOut = function() {
curs.gotoAndStop(1);
promptopen = 0;
prompt.play();
};
mu.onDragOut = function() {
promptopen = 0;
prompt.play();
};
mu.onPress = function() {
m3.start(0, 1);
mu.play();
murel = 0;
};
mu.onRelease = function() {
mu.play();
murel = 1;
if (propmusic == 0) {
propmusic = 1;
timemusic1 = m1.position/1000;
m1.stop("M");
m9.attachSound("Заглушка");
} else {
m1.start(timemusic1, 1);
m9.attachSound("test-music");
propmusic = 0;
}
};
mu.onReleaseOutside = function() {
mu.play();
murel = 1;
if (propmusic == 0) {
propmusic = 1;
timemusic1 = m1.position/1000;
m1.stop("M");
m9.attachSound("Заглушка");
} else {
m1.start(timemusic1, 1);
propmusic = 0;
m9.attachSound("test-music");
}
};
so.onRollOver = function() {
m2.start(0, 1);
curs.gotoAndStop(2);
prompt.message1 = "Вкл./Выкл.";
prompt.play();
promptopen = 1;
};
so.onRollOut = function() {
promptopen = 0;
prompt.play();
curs.gotoAndStop(1);
};
so.onDragOut = function() {
promptopen = 0;
prompt.play();
};
so.onPress = function() {
m3.start(0, 1);
so.play();
sorel = 0;
};
so.onRelease = function() {
if (propsound == 0) {
propsound = 1;
m2.attachSound("Заглушка");
m3.attachSound("Заглушка");
m7.attachSound("Заглушка");
m8.attachSound("Заглушка");
m5.start(0, 1);
} else {
m2.attachSound("Наведение");
m3.attachSound("Нажатие");
m7.attachSound("slidernaved");
m8.attachSound("vzriv");
m4.start(0, 1);
propsound = 0;
}
so.play();
sorel = 1;
};
so.onReleaseOutside = function() {
if (propsound == 0) {
propsound = 1;
m2.attachSound("Заглушка");
m3.attachSound("Заглушка");
m7.attachSound("Заглушка");
m8.attachSound("Заглушка");
} else {
m2.attachSound("Наведение");
m3.attachSound("Нажатие");
m7.attachSound("slidernaved");
m8.attachSound("vzriv");
propsound = 0;
}
so.play();
sorel = 1;
};
Они предсавлят из себя кнопки для выключения и включения музыки и звуковых эффектов. В этой сцене обсалютно все работает. А вот в других сценах, где он(подобный код) нужет, не работает.