function genera_sistema() {
//-----------
var tutti = new Array();
var sublist = new Array();
var a_length = 20;
var n_array = 12;
var n_length = 10;
// Generazione primo array "tutti"
while (a_length) {
tutti.unshift(a_length--);
//_root.testo.text = _root["tutti"+i];
_root.testo.text = tutti.join(" - ");
}
function generateNew(origin, len) {
var gen = new Array();
for (var i = 0; i<len; i++) {
var pos = Math.round(Math.random()*origin.length)-1;
gen.push(origin.splice(pos, 1));
}
return gen;
//---------------------------------------------------------------
Se racchiudo tutto in una funzione (evidenziata in grassetto) e la starto poi da bottone apposito lo script funge solo fino a qui...why???
![]()
![]()
se non uso la funzione.. mi funge tutto...![]()
VVoVe:
//----------------------------------------------------------------
}
while (n_array) {
var temp = generateNew(tutti.slice(), n_length);
sublist.push(temp);
n_array--
//_root.testo2.text = _root["sublist"+i];
array_disordinato= _root.sublist.slice().join(" \n ")
_root.array_disordinato.sort(sortNumberASC);
_root.testo2.text =array_disordinato;
//------------
}
Il codice del bottone che la dovrebbe startare per intero...
on (release) {
_root.genera_sistema();
}