So this is a weird error that I am getting because I have four movie clips on my frame that I have running back and forth across the screen in a frogger like game. Three of them work and the fourth one does not even though I have the same code basically for all of them. Why would I get an error for one, but not the other 3? Here is my code:
if((chris.x - laneOne) >= 0 && !turn1){
chris.scaleX = 1;
chris.x -= laneOne;
turn1 = false;
}else{
turn1 = true;
}
if((chris.x + laneOne) <= 500 && turn1){
chris.scaleX = -1;
chris.x += laneOne;
turn1 = true;
}else{
turn1 = false;
}
//Lane 2
if((kate.x - laneTwo) >= 0 && !turn2){
kate.scaleX = 1;
kate.x -= laneTwo;
turn2 = false;
}else{
turn2 = true;
}
if((kate.x + laneTwo) <= 500 && turn2){
kate.scaleX = -1;
kate.x += laneTwo;
turn2 = true;
}else{
turn2 = false;
}
//Lane 3
/*if((seth.x - laneThree) >= 0 && !turn3){
seth.scaleX = 1;
seth.x -= laneThree;
turn3 = false;
}else{
turn3 = true;
}
if((seth.x + laneThree) <= 500 && turn3){
seth.scaleX = -1;
seth.x += laneThree;
turn3 = true;
}else{
turn3 = false;
}*/
//Lane 4
if((mel.x - laneFour) >= 0 && !turn4){
mel.scaleX = 1;
mel.x -= laneFour;
turn4 = false;
}else{
turn4 = true;
}
if((mel.x + laneFour) <= 500 && turn4){
mel.scaleX = -1;
mel.x += laneFour;
turn4 = true;
}else{
turn4 = false;
}
Seth is the one that doesn't work, but basically this makes these movie clips of running characters look like they are running back and forth and the lanes is the speed at which they go and the turns are just to make sure that they go all the way to the side.
That is my first question.
My second question is I have a character on the same frame and I want to move him via the keyboard and I am using senocular's keyObject class and it doesn't work unless if I minimize the screen and then re-open the screen. Once I re-open the screen it works just fine.
I have a hunch that both of these problems are related to a movie clip not being fully loaded, but I am new to flash and as3 so any help would be greatly appreciated. Also if more clarification is needed please ask for it so I can get some help cause I have had this problem for about 2 days now and still can't figure it out!