there are several ways to handle this, but the easiest is to keep track of those photons that are on-stage, remove the ones that are not on-stage and use a hitTest on each of the existing photons. that will solve a number of problems that you are encountering or will encounter.
"the easiest is to keep track of those photons that are on-stage"
what do you mean keep track?
"remove the ones that are not on-stage"
that's precisely what I do not know how to do. I have been unable to effect the particles of a particle system on an individual basis.
"and use a hitTest on each of the existing photons".
My previous attempt to place a for - loop inside another for loop failed. The particles still appeared but the collision detection was nonexistent.
1 person found this helpful
i don't see where you're updating the photons position so i assume you're using timeline animation to move the photons. if that's true, place the following on the last frame of the photon's timeline:
and loop through all the children of the photon's parent movieclip using them in your hittest.
ok, so I added the remove movieclip at the end of the particle timeline,
and then cut down the i<500 to i<80, and added the c4.cap hitTest;
photons = this["photon"+i];
var k:MovieClip = robot_mc.laser_mc.lasereye_mc.attachMovie("photon","photon"+i ,robot_mc.laser_mc.lasereye_mc.getNextHighestDepth());
k._xscale = Math.random()* 120 - 20;
k._yscale = Math.random()* 220 + 35;
k._y -= Math.random()* 15 + 10; //plus changes distance of start of beam, base changes range
c4 = this["red"+m];
} //end c4 for loop
} // end photon for loop
and duplicated the loop for the c4 module. It now works like a charm ^_^
kglad solved the problem with the removemovieclip solution inside the particle's timeline, and the for loop inside the second for loop only needed slight modification.