... ho gia' capito che nel tuo caso potresti anche aver capito ma ti senti incasinato ... facciamo cosi', vediamo se questo va
codice:stop(); var myVars = new LoadVars(); myVars.path = this; myVars.onLoad = function() { for (i=0; i < 10; i++) { this.path["tab"+i].name.text = this["name"+i] + " " + this["sname"+i]; this.path["tab"+i].role.text = this["role"+i]; this.path["tab"+i].numb.text = this["numb"+i]; var myTime = this["time"+i]; this.path["tab"+i].onRelease = function() { _root.display.time.htmlText = myTime; // questo perche' un this qui dentro // risulterebbe associato al bottone // e non al this di myVars ... } } } myVars.load("dbpass.php");
altro esempio, sempre per spiegare
codice:myVars.onLoad = function() { for (i=0; i < 10; i++) { this.path["tab"+i].name.text = this["name"+i] + " " + this["sname"+i]; this.path["tab"+i].role.text = this["role"+i]; this.path["tab"+i].numb.text = this["numb"+i]; // posso anche assegnare ad una nuova var del bottone this.path["tab"+i].time = this["time"+i]; this.path["tab"+i].onRelease = function() { _root.display.time.htmlText = this.time; // cosi' this sara' riferito a this.path["tab"+i] // e non a myVars["time"] che non esiste ... } } }


Rispondi quotando