ho provato e riprovato,ma proprio non capisco..
sto impazzendo per una gallery che carica le jpg tramite file di testo e ne crea anche le tumbnails.
Ho preso il codice dall'horizontal gallery di rempox..o meglio ho preso tutto non solo il codice!
il problema è che una volta caricata,non riesco piu a scaricarla!
Funziona cosi..io clicco su "gallery" e il mio filmato si sposta sul frame dove sono posizionati il codice e gli mc,ma una volta che clicco un altro pulsante,il filamto si sposta sul determinato frame,ma la gallery nn se ne vaaaaaaaaaaa!!!
penso sia un problema di mc che vengono attaccati al filmato..ma nn so proprio risolverlo..help me pleazeeee!
posto il codice...
codice:
name_photo=new LoadVars()
name_photo.onLoad=function(success){
if(success){
_root.prefix=this.name
_root.ID_MAX=this.total
_root.go()
}
}
name_photo.load("parametri.txt")
W_box=H_box=60
W_box_pic=H_box_pic=50
Space_box=5
mask.swapDepths(100)
mask._x=517
mask._y=531
this.createEmptyMovieClip("cont",1)
cont._x=mask._x
cont._y=mask._y
cont.setMask(mask)
function go(){
i=1
this.onEnterFrame=function(){
if(i<=ID_max)
{
if(i<=9){img = prefix+"00"+i+".jpg";}
if(i>9 && i<=99){img = prefix+"0"+i+".jpg";}
if(i>99){img = prefix+i+".jpg";}
trace(img)
cont.attachMovie("box","box"+i,i)
// assegno un nome di comodo al clip
mc = eval(cont["box"+i]);
mc._x=(W_box+Space_box)*i-W_box;mc._y=0
// carico l'immagine
mc.path=img
mc.pic_box.loadMovie(img);
mc.onEnterFrame=function(){
if (this.pic_box.getBytesLoaded()>1024 && this.pic_box.getBytesLoaded() == this.pic_box.getBytesTotal())
{
// calcolo dimensioni originali
this.larg=this.pic_box._width
this.alt=this.pic_box._height
trace(this.larg)
// chiamo la funzione di re-dimensionamento
this.pic_box._xscale = Math.floor(_root.W_box_pic*100/this.larg)
this.pic_box._yscale = Math.floor(_root.H_box_pic*100/this.alt)
this.pic_box._alpha=0
this.pic_box.onEnterFrame = function(){
// enterFrame per aumentare gradualmente l'alpha dell'immagine caricata
if(this._alpha < 100){this._alpha+=20;}
else {this._alpha = 100;delete this.onEnterFrame;}
}
this.pic_box.setMask(this.msk)
tot++
delete this.onEnterFrame
}
}
// -----------------------
mc.onPress=function(){
_root.attachMovie("big","big",1000)
_root.big._x=this._x
_root.big._y=this._y
_root.big.box.loadMovie(this.path)
_root.big.box._alpha=0
_root.big.onEnterFrame=function()
{
if (this.box.getBytesLoaded()>1024 && this.box.getBytesLoaded() == this.box.getBytesTotal())
{
//Lo rimetto alle sue vere dimensioni
this.box._xscale = this.box._yscale = 100;
//Dimensioni Originali
W = this.box._width;
H = this.box._height;
//
// ridimensionamento dell'immagine in base all'area disponibile
//
MaxW = 1490; // larghezza massima disponibile
MaxH = 500; // altezza massima disponibile
MaxP = MaxH*100/MaxW; // % larghezza su altezza
//
theW = W; // larghezza effettiva
theH = H; // altezza effettiva
theP = theH*100/theW; // rapporto W/H
//
if (W>MaxW) {
if (H>MaxH) {
if (theP<=MaxP) {
theW = MaxW;
theH = MaxW*theP/100;
} else {
theW = MaxH/theP*100;
theH = MaxH;
}
} else {
theW = MaxW;
theH = MaxW*theP/100;
}
} else {
if (H>MaxH) {
theW = MaxH/theP*100;
theH = MaxH;
} else {
// qui l'immagine sta già dentro l'area disponibile
// per cui le istruzioni seguenti sono "ridondanti"
// le ho lasciate "commentate" per una miglior lettura...
//theW = W; // larghezza effettiva
//theH = H; // altezza effettiva
}
}
// imposto Larghezza e Altezza con i valori calcolati
theW = Math.floor(theW);
theH = Math.floor(theH);
this.box._width=theW
this.box._height=theH
_root.big._x=(MaxW-_root.big._width)/2
_root.big._y=10+(MaxH-_root.big._height)/2
this.box.onEnterFrame = function()
{
if(this._alpha < 99){this._alpha+=20;}
else {this._alpha = 99;delete this.onEnterFrame;}
}
delete this.onEnterFrame
}// fine If
}// fine enter Frame
} //fine McOnPress
// -----------------------
i++
}else{delete this.onEnterFrame} // fine IF
} //fine enter
} // fine function
p.onPress=function(){
cont.onEnterFrame=function(){
if(cont._x+cont._width>mask._x+mask._width){
cont._x-=(W_box+Space_box)
}
}
}
p.onRelease=function(){
delete cont.onEnterFrame
}
m.onPress=function(){
cont.onEnterFrame=function(){
if(cont._x<mask._x){
cont._x+=(W_box+Space_box)
}
}
}
m.onRelease=function(){
delete cont.onEnterFrame
}
start.onPress=function(){
cont._x=mask._x
}
end.onPress=function(){
cont._x=mask._x+mask._width-cont._width-5
}
close.onPress=function(){big.unloadMovie()}
grazie!