Loop stop unexpected?

Hi all,

Haven’t been here for a while so I’m a bit stuck.

I have a headline that I want to fade in one letter at a time, I want the letters to fade in random so each time the letters fade in it will be random.

I have broken the text apart and made each letter into a movie clip then placed a reference to the clips into an array.

Within a loop I then generate a random number based on the length of the array and then fade in that letter from the array, and then remove that letter from the array.

The problem is the loop stops after 5 letters are visible but the array containes 8 letters.

The code doesn’t have a fade function until I get the loading working.


var letters:Array = new Array(T_mc, E2_mc, S_mc, T2_mc, N_mc, A_mc, M_mc, E_mc);
//
for (var n = 0; n<=letters.length; n++) {
	letters[n]._alpha = 0;
}
for (var i = 0; i<=letters.length; i++) {
	var ranNum:Number = Math.floor(Math.random()*letters.length);
	letters[ranNum]._alpha = 100;
	letters.splice(ranNum, 1);
	trace(letters);
}