For some reason, Firefox freezes when these functions run in JavaScript:
function actionMenuLeave (xOne, xTwo, xThree, xFour, xTwoMove, xThreeMove, xFourMove, i) {
if (xOne > 0) { xOne = xOne - .1; }
if (xOne = 0.5) { xTwoMove = 1;}
if (xTwoMove = 1) {xTwo = xTwo - .1;}
if (xTwo = 0.5) { xThreeMove = 1;}
if (xThreeMove = 1) {xThree = xThree - .1;}
if (xThree = 0.5) { xFourMove = 1;}
if (xFourMove = 1) {xFour = xFour - .1;}
if (xFour = 0) {i = 1;}
panelTransition (xOne, xTwo, xThree, xFour) ;
if(i == 0){
setInterval (function () {actionMenuLeave(xOne, xTwo, xThree, xFour, xTwoMove, xThreeMove, xFourMove, i)}, 10);
}
}
function panelTransition (xOne, xTwo, xThree, xFour) {
panelContext.clearRect (0,0,400,100);
if (menu == 0) { //Main
panelContext.fillStyle = "#FFAAAA";
panelContext.fillRect (0,0,100,(100*xOne));
panelContext.fillStyle = "#A89058";
panelContext.fillRect (100,0,200,(100*xTwo));
panelContext.fillStyle = "#AAAAFF";
panelContext.fillRect (200,0,300,(100*xThree));
panelContext.fillStyle = "#BBBBBB";
panelContext.fillRect (300,0,400,(100*xFour));
}
if (menu == 1) { //Attack
panelContext.fillStyle = "#FFAAAA";
panelContext.fillRect (0,0,100,(100*xOne));
panelContext.fillStyle = "#FFAAAA";
panelContext.fillRect (100,0,200,(100*xTwo));
panelContext.fillStyle = "#FFAAAA";
panelContext.fillRect (200,0,300,(100*xThree));
panelContext.fillStyle = "#FFAAAA";
panelContext.fillRect (300,0,400,(100*xFour));
}
if (menu == 2) { //Defense
panelContext.fillStyle = "#A89058";
panelContext.fillRect (0,0,100,(100*xOne));
panelContext.fillStyle = "#A89058";
panelContext.fillRect (100,0,200,(100*xTwo));
panelContext.fillStyle = "#A89058";
panelContext.fillRect (200,0,300,(100*xThree));
panelContext.fillStyle = "#A89058";
panelContext.fillRect (300,0,400,(100*xFour));
}
if (menu == 3) { //Contigency
panelContext.fillStyle = "#AAAAFF";
panelContext.fillRect (0,0,100,(100*xOne));
panelContext.fillStyle = "#AAAAFF";
panelContext.fillRect (100,0,200,(100*xTwo));
panelContext.fillStyle = "#FFAAAA";
panelContext.fillRect (200,0,300,(100*xThree));
panelContext.fillStyle = "#AAAAFF";
panelContext.fillRect (300,0,400,(100*xFour));
}
if (menu == 4) { //Movement
panelContext.fillStyle = "#BBBBBB";
panelContext.fillRect (0,0,100,(100*xOne));
panelContext.fillStyle = "#BBBBBB";
panelContext.fillRect (100,0,200,(100*xTwo));
panelContext.fillStyle = "#BBBBBB";
panelContext.fillRect (200,0,300,(100*xThree));
panelContext.fillStyle = "#BBBBBB";
panelContext.fillRect (300,0,400,(100*xFour));
}
}
I know that at they're being called, so I assume that actionMenuLeave must be screwing up somehow. I checked for mistakes I had made before, and the only thing I haven't gotten to work in the past is setInterval. Am I doing something wrong with that command?