My code goes like this:
if (hitTestObject(target.hit))
{ //pushes a number into an array
stageRef.addChild(new Explosion(stageRef, x, y));
myArray.push(myArray.length);
removeSelf();
//checks array length
if (myArray.length == 3){
gotoAndStop(2);
trace(myArray.length);
When I run this, I get a number and a "Hit" Displayed in the output console, so every time the hittest is called, it should go up by 1 to show:
1
Hit
2
Hit
3
Hit
However, I'm getting seemingly random repeated numbers in this manner:
1
Hit
1
Hit
2
Hit
1
Hit
3
Hit
3
Hit
5
Hit
1
Hit
What could be causing this?