try
for(var i:int = ster.length -1; i >= 0; i--)
{
ster[i].y = ster[i].y + 5;
if( hero.hitTestObject(ster[i]) ) {
ster[i].visible = false;
score = score +1;
Score.text = ""+ score;
removeChild(ster[i]);
ster.splice(i, 1);
}
}
пример:
var ar:Array = [0,1,2,3,4,5,6,7,8,9,10]
for(var i:int = ar.length - 1; i >= 0; i--){
if(i % 2 == 0){
tf.text += i + ' : ' + ar[i] + '\n';
ar.splice(i,1);
}
}
tf.text += 'so : ' + ar.join(', ');
tf.text
is
10: 108: 86: 64: 42: 20: 0итак: 1, 3, 5, 7, 9