ciao a tutti, con questo codice ho una slideshow temporizzata di n foto.
visualizzata in locale sembra tutto OK,ma se testo con la simulazione scaricamento (56K,ADSL...) non sono sufficienti i 6 secondi impostati nel setInterval e quindi vedo la percentuale di caricamento che pero' non arriva mai al 100% e quindi non vedo nessuna foto.
Cosa devo impostare per dirgli se ha caricato tutta la foto allora passa alla successiva?
foto= 44;
codice:_root.slide.onRelease=function(){ intervalID = setInterval(function () { img = "slide1/foto"+foto+".jpg" _root.big.cont.loadMovie(img); _root.big.cont._alpha = 0; //carico la foto grande con il preload _root.big.onEnterFrame = function() { car=this.cont.getBytesLoaded() // byte caricati tot=this.cont.getBytesTotal() // byte totali percentuale = Math.floor((this.cont.getBytesLoaded()/tot)*100); //+ Int(this.cont.getBytesLoaded()/1024) + "KB di " + Int(this.cont.getBytesTotal()/1024) _root.cont_perc.perc.text = percentuale+"% "; if (car == tot && car > 1024) { larg =this.cont._width; alt = this.cont._height; //trace("larg1 = " + larg + " alt1 = " + alt) _root.resizeimg._height=0 _root.resizeimg._width=0 _root.cont_perc.perc.text = ""; _root.resizeimg._alpha=100 _root.resizeimg.onEnterFrame = function() { if (this._width<=larg-1 && this._height <=alt-1) { myResize(this,larg+20,alt+20,4) trace("largh resizeimg="+this._width+" alt resizeimg="+this._height+alt+larg) trace("sto scalando " + this._width) } else { _root.big._x =_root.resizeimg._x-larg/2; _root.big._y =_root.resizeimg._y-alt/2; _root.big.cont._alpha = 100; var scale:Object = new ScaleSquare(_root.big, 4,4,_root.big._width, _root.big._height, true, Elastic.easeOut); _root.cont_slide_expo._y = _root.big._y+_root.big._height + 30 _root.dx._y = _root.big._y+_root.big._height + 55 _root.sx._y = _root.big._y+_root.big._height + 55 _root.totalefoto._y = _root.big._y+_root.big._height +35 trace("cancello il resize") foto++; delete this.onEnterFrame; } } delete this.onEnterFrame; } } trace(foto+""+totali) if (foto == totali){ clearInterval(intervalID) } },6000); }![]()

Rispondi quotando