Delete from Array

ActionScript Code:
[FONT=Courier New][LEFT]var delay = [COLOR=#000080]6000[/COLOR];
[COLOR=#000000]function[/COLOR] adCOLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
adInterval = [COLOR=#0000FF]setInterval[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]pause[/COLOR], delay[COLOR=#000000])[/COLOR];
[COLOR=#000000]function[/COLOR] [COLOR=#0000FF]pause[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR][COLOR=#808080]**[/COLOR]
integer = [COLOR=#000000]new[/COLOR] [COLOR=#0000FF]Array[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000080]0[/COLOR], [COLOR=#000080]1[/COLOR], [COLOR=#000080]2[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#0000FF]trace[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#0000FF]delete[/COLOR] integer[COLOR=#000000][[/COLOR]current[COLOR=#000000]][/COLOR];
integer.[COLOR=#0000FF]splice[/COLOR][COLOR=#000000]([/COLOR]current, [COLOR=#000080]1[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#0000FF]trace[/COLOR]COLOR=#000000[/COLOR];
i = integer.[COLOR=#0000FF]length[/COLOR];
k = [COLOR=#0000FF]Math[/COLOR].[COLOR=#0000FF]floor[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000FF]Math[/COLOR].[COLOR=#0000FF]random[/COLOR]COLOR=#000000[/COLOR] * i[COLOR=#000000])[/COLOR];
[COLOR=#000000]var[/COLOR] current = k;
[COLOR=#000000]var[/COLOR] ad_string:[COLOR=#0000FF]String[/COLOR] = [COLOR=#FF0000]“mc”[/COLOR] + k;
[COLOR=#0000FF]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]“The mc”[/COLOR]+current+[COLOR=#FF0000]" should not be loaded next"[/COLOR][COLOR=#000000])[/COLOR];
ad_mc.[COLOR=#0000FF]attachMovie[/COLOR][COLOR=#000000]([/COLOR]ad_string, ad_string, [COLOR=#000080]0[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]
adCOLOR=#000000[/COLOR];
[/LEFT]
[/FONT]

Can someone tell me why this still allows the removed movieclip to be loaded

Not exactly sure what you are doing but you are creating a new array each loop and the variable “current” is undefined at the start of the loop.
maybe something like this will work for you

var delay = 6000;
integer = new Array(1, 2, 3);
function ad() {
	adInterval = setInterval(pause, delay);
	function pause() {
		k = Math.floor(Math.random()*integer.length);
		trace("mc"+integer[k]);
		integer.splice(k, 1);
		if (!integer.length) {
			clearInterval(adInterval);
		}
	}
}
ad();

Thanks Stringy,
I realize now that I look at it what I posted was really obscure.

Anyways what I was looking to do was make a random movie loader, that reloads 3 mc but never the same mc twice.

[AS]var delay = 6000;
function ad() {
adInterval = setInterval(pause, delay);
function pause() {
integer = new Array(0, 1, 2);
integer.splice(current, 1);
trace(integer);
k = Math.floor(Math.random() * integer.length);
trace(“loading mc” + integer[k]);
var ad_string:String = “images/160_60_pes” + integer[k] + “.swf”;
ad_mc.loadMovie(ad_string);
trace(“mc” + integer[k] + " should not be loaded next");
current = integer[k];
}
}[/AS]

it creates the default array, then splices out the last mc viewed, so it cannot be reloaded. With the new array it randomly picks one then loads it and sets the array back to the default and continues.

Your post was quite helpful even though you didn’t catch what it was I attempting to do.

Sorry for the confusion, and thanks for trying to help.

developmental