e chi l'ha mai provatoOriginariamente inviato da Falcao
una curiosità, ma a te quanto ci mette per completare il mio esempio?
no perchè a me con fastweb ci mette sui 560 ms... non male!![]()
Classe LoadVars2()
... visto che vi voglio bene vi faccio gestire anche l' Interval
codice:class LoadVars2 extends LoadVars { // andr3a [ www.3site.it ] [ 25/11/2003 ] // Thanks to: negatyve / Falcao / bubu77 // from HTML.IT [ www.html.it ] private var myIntCheck:Number; function LoadVars2() { super(); } public function load(url:String):Void { super.load(url); setMyInterval(); } public function sendAndLoad(url:String, return_var:Object, method:String):Void { method = method != undefined ? method : "POST"; super.sendAndLoad(url, return_var, method); setMyInterval(); } public function stopLoading():Void { clearInterval(myIntCheck); } private function setMyInterval():Void { myIntCheck = setInterval(this, "checkCharge", 20); } private function checkCharge():Void { var loadedBytes:Number = getBytesLoaded() != undefined ? getBytesLoaded() : 0; var totalBytes:Number = getBytesTotal() != undefined ? getBytesTotal() : 0; if( this.onLoadProgress != undefined ) { this.onLoadProgress(loadedBytes, totalBytes); } if( loadedBytes > 0 && loadedBytes >= totalBytes) { clearInterval(myIntCheck); } } }
Cosa e' cambiato ??
avete solo un metodo in piu' che vi permette di stoppare l' intervallo che cerca dati da macinare![]()
Esempio:
codice:var serverbytes = new LoadVars2(); serverbytes.onLoad = function(success) { if(success) { trace("____________________________________"); trace("Caricati: " + this.getBytesLoaded()); trace("Totali: " + this.getBytesTotal()); } else { trace("Errore!"); this.stopLoading(); } } serverbytes.onLoadProgress = function(loadedBytes, totalBytes) { trace(loadedBytes + " - " + totalBytes); } serverbytes.load("http://miosito/miofile.php");
@ falcao
io e te semo come nVidia e ATI, se non c'eravamo noi non c'erano pillole e concorrenza



Rispondi quotando