intanto ecco la funzione di "scambio" che restituisce un nome di istanza diverso ogni volta che viene richiamata
Codice PHP:
var instance:String = "X";
var elements:Array = ["Y", "Q", "Z"];
function getRandomElement ():String {
var temp = Math.floor(Math.random()*elements.length);
var temps = elements[temp];
elements.splice(temp, 1);
elements.push(instance)
instance = temps;
return temps;
}
se fai un test con quest'altro codice vedrai tracciare ogni volta una stringa diversa tra quelle scritte
Codice PHP:
function intFunc () {
trace(getRandomElement());
}
var a = setInterval(intFunc, 1000);
proseguo...