magnetic_monste
03-25-2003, 09:07 PM
Code:
function navAnimation() {
if (menuOpen == "false") {
x=0;
}
if (x>=40) {
clearInterval(navAnimation);
} else {
for(i=0; i<xmlNavPhotosSubject_Arr.length; i++) {
_root.mainNav_mc["subjectText_mc"+i]._y = (math.sin(x/20)*50)*-i;
}
x++;
}
}
_root.mainNav_mc.b2_mc.onRelease = function() {
if (menuOpen == "true") {
//close menu code
trace("Menu Close");
for (navC1=0; navC1<xmlNavPhotosSubject_Arr.length; navC1++) {
_root.mainNav_mc["subjectText_mc"+navC1].removeMovieClip();
}
menuOpen = "false";
} else {
//open menu code
trace("Menu Open");
for (navC1=0; navC1<xmlNavPhotosSubject_Arr.length; navC1++) {
_root.mainNav_mc.subjectText_mc.duplicateMovieClip ("subjectText_mc"+navC1, navC1);
_root.mainNav_mc["subjectText_mc"+navC1].subjectText.text = xmlNavPhotosSubject_Arr[navC1];
}
setInterval(navAnimation, 1000);
menuOpen = "true";
}
};
Heres the problem, the setInterval calling the funtion at the top works fine the first time its called (in this case when a button movieclip is clicked) but when called again (when the button is clicked for a third time, the second time closes the menu) the setInterval does not seem to pay any attention to the timeing and the fuction repeats itself as fast as it can. As I continue to click the button the menu just expands quicker, I have attached the fla if you don't understand what I mean (I'm not sure I do!). Thanks in advance for any help...
function navAnimation() {
if (menuOpen == "false") {
x=0;
}
if (x>=40) {
clearInterval(navAnimation);
} else {
for(i=0; i<xmlNavPhotosSubject_Arr.length; i++) {
_root.mainNav_mc["subjectText_mc"+i]._y = (math.sin(x/20)*50)*-i;
}
x++;
}
}
_root.mainNav_mc.b2_mc.onRelease = function() {
if (menuOpen == "true") {
//close menu code
trace("Menu Close");
for (navC1=0; navC1<xmlNavPhotosSubject_Arr.length; navC1++) {
_root.mainNav_mc["subjectText_mc"+navC1].removeMovieClip();
}
menuOpen = "false";
} else {
//open menu code
trace("Menu Open");
for (navC1=0; navC1<xmlNavPhotosSubject_Arr.length; navC1++) {
_root.mainNav_mc.subjectText_mc.duplicateMovieClip ("subjectText_mc"+navC1, navC1);
_root.mainNav_mc["subjectText_mc"+navC1].subjectText.text = xmlNavPhotosSubject_Arr[navC1];
}
setInterval(navAnimation, 1000);
menuOpen = "true";
}
};
Heres the problem, the setInterval calling the funtion at the top works fine the first time its called (in this case when a button movieclip is clicked) but when called again (when the button is clicked for a third time, the second time closes the menu) the setInterval does not seem to pay any attention to the timeing and the fuction repeats itself as fast as it can. As I continue to click the button the menu just expands quicker, I have attached the fla if you don't understand what I mean (I'm not sure I do!). Thanks in advance for any help...