I want to make sure clones don’t stack up when I revisit the same frame, but when I try to remove any previous instances I get this error
I have a controller holder clip called energyStores_mc with a series of scripted energy store simulations (vibration_mc, thermal_mc, etc) - one clip in each frame.
Using a menu you can advance the play head to whichever store you want to see the simulation for.
The simulations have moving particles, which are produced using clone.
This is part of the code in the vibration_mc, which clones a series of vibrating particles.
onEvent('load', function () {
if (project.vibrationInitialised === 0){
makeParticles();
project.vibrationInitialised++;
} else {
removeParticles();
makeParticles();
}
locateParticles();
});
function removeParticles(){
for (var i = 1; i <= numberOfParticles; ++i){
particles[i].remove();
}
}
function makeParticles(){
particles[1] = randVibration_mc;
for (var i = 2; i <= numberOfParticles; ++i){
particles[i] = randVibration_mc.clone();
}
}
It seems to be happy enough to produce endless clones every time I play the clip, but can’t find them when I try to remove them.
Any thoughts gratefully received.