I’m trying to make a game where apples fall but I cannot set intervals for every created movieclip. When I create it with the code below, move of the apple stops when another one is created.
function FallAnApple()
{
_apple = "apple_" + _counter;
attachMovie("apple", _apple, _counter);
eval(_apple)._x = RandomX();
eval(_apple)._y = -16;
setInterval(function(){eval(_apple)._y += 2;}, 100);
_counter += 1;
}
When I put an interval inside apple movieclip, I cannot access this._y inside the interval, but I can access this value inside the created movie itself.
Just keep an array of your apples as you create them, and then change the coordinates of each apple in the array when the interval fires.