Preloader en galeria X ML
Publicado por Akane (3 intervenciones) el 25/01/2009 06:43:18
Saludos todos los programadores!!!
Estoy desarrollando una galeria en flash 8, las imagenes las cargo externamente mediante un XML. Pero al subirla la galeria a la web algunas imagenes tardan mucho en aparecer y por eso quiero agregarle un Preloader a cada imagen.Mi galeria esta asi: del lado derecho se desplazan las imagenes pequeñas cuando se da clic sobre ellas del lado izquierdo aparece la imagen en grande . El codigo que uso para hacer es:
larghezzamovie = Stage.height;
posSin = 1;
vel = -2;
dimImm = 150;//Tamaño del panel de galeria
selezione._x = 50;
letto = false;
pos_iniziale = Stage.width-dimImm;
larghezzamovie = Stage.height;
posSin = 1;
vel = -2;
dimImm = 150;//Tamaño del panel de galeria
selezione._x = 50;
letto = false;
pos_iniziale = Stage.width-dimImm;
_root.mc_desc.sf_desc._width = pos_iniziale;
leggi = function () {
dos = new XML();
dos.ignoreWhite = true;
dos.load("miarchivo.xml");
dos.onLoad = function(success) {
if (success) {
nfoto = this.childNodes.length;
posDes = nfoto;
for (i=0; i<nfoto; i++) {
_root.attachMovie("mc","mc"+(i+1),i+1);
_root["mc"+(i+1)]._y = dimImm*i;
_root["mc"+(i+1)]._x = pos_iniziale;
_root["mc"+(i+1)].big = this.childNodes[i].attributes.photo_big;
_root["mc"+(i+1)].desc = this.childNodes[i].attributes.descrizione;
_root["mc"+(i+1)].contenitore.loadMovie(this.childNodes[i].attributes.photo);
_root["mc"+(i+1)]._alpha = 50;
_root.box.clip_mc.loadMovie(this.childNodes[0].attributes.photo_big);
_root.pre.loadMovie(this.childNodes[i].attributes.photo_big);
_root.image = this.childNodes[0].attributes.photo_big;
_root.mc_desc.descrizione.text = this.childNodes[0].attributes.descrizione;
_root["mc"+(i+1)].onRelease = released;
_root["mc"+(i+1)].onRollOver = rollover;
_root["mc"+(i+1)].onRollOut = rollout;
_root["mc"+(i+1)].onReleaseOutside = rollout;
}
letto = true;
} else {
_root.didascalia.text = "Error al cargar la foto";
}
};
};
leggi();
_root.onMouseMove = function() {
x = _root._xmouse;
y = _root._ymouse;
if (x>pos_iniziale) {
if (y>0 && y<60) {
vel = -(Math.round((y-(larghezzamovie/2))/35));
}
if (y>260 && y<larghezzamovie) {
vel = -(Math.round((y-(larghezzamovie/2))/35));
}
} else {
if (vel>-1) {
vel = 2;
} else {
vel = -2;
}
}
};
function released() {
_root.image = this.big;
_root.box.play();
_root.box.clip_mc.loadMovie(_root.image);
_root.mc_desc.descrizione.text = this.desc;
//_root.selezione._y = (larghezzamovie)/2;
//_root.didascalia.text = this.etichetta.text;
//getURL(percorso,"_blank")
}
function rollover() {
this._alpha = 100;
}
function rollout() {
this._alpha = 50;
}
_root.onEnterFrame = function() {
if (letto) {
for (i=1; i<=nfoto; i++) {
_root["mc"+i]._y += vel;
}
if (vel>0 && _root["mc"+posSin]._y>0) {
_root["mc"+posDes]._y = _root["mc"+posSin]._y-dimImm;
posSin = posDes;
posDes--;
if (posDes == 0) {
posDes = nfoto;
}
}
if (vel<0 && _root["mc"+posSin]._y<=-dimImm) {
_root["mc"+posSin]._y = _root["mc"+posDes]._y+dimImm;
posDes = posSin;
posSin++;
if (posSin>nfoto) {
posSin = 1;
}
}
}
};
Les agradeceria enormemente que me ayudaran a poner un preloader para que se muestre antes de cada imagen "grande" . Mil gracias de antemano por tomarse el tiempo de leer...
Espero respuestas
Estoy desarrollando una galeria en flash 8, las imagenes las cargo externamente mediante un XML. Pero al subirla la galeria a la web algunas imagenes tardan mucho en aparecer y por eso quiero agregarle un Preloader a cada imagen.Mi galeria esta asi: del lado derecho se desplazan las imagenes pequeñas cuando se da clic sobre ellas del lado izquierdo aparece la imagen en grande . El codigo que uso para hacer es:
larghezzamovie = Stage.height;
posSin = 1;
vel = -2;
dimImm = 150;//Tamaño del panel de galeria
selezione._x = 50;
letto = false;
pos_iniziale = Stage.width-dimImm;
larghezzamovie = Stage.height;
posSin = 1;
vel = -2;
dimImm = 150;//Tamaño del panel de galeria
selezione._x = 50;
letto = false;
pos_iniziale = Stage.width-dimImm;
_root.mc_desc.sf_desc._width = pos_iniziale;
leggi = function () {
dos = new XML();
dos.ignoreWhite = true;
dos.load("miarchivo.xml");
dos.onLoad = function(success) {
if (success) {
nfoto = this.childNodes.length;
posDes = nfoto;
for (i=0; i<nfoto; i++) {
_root.attachMovie("mc","mc"+(i+1),i+1);
_root["mc"+(i+1)]._y = dimImm*i;
_root["mc"+(i+1)]._x = pos_iniziale;
_root["mc"+(i+1)].big = this.childNodes[i].attributes.photo_big;
_root["mc"+(i+1)].desc = this.childNodes[i].attributes.descrizione;
_root["mc"+(i+1)].contenitore.loadMovie(this.childNodes[i].attributes.photo);
_root["mc"+(i+1)]._alpha = 50;
_root.box.clip_mc.loadMovie(this.childNodes[0].attributes.photo_big);
_root.pre.loadMovie(this.childNodes[i].attributes.photo_big);
_root.image = this.childNodes[0].attributes.photo_big;
_root.mc_desc.descrizione.text = this.childNodes[0].attributes.descrizione;
_root["mc"+(i+1)].onRelease = released;
_root["mc"+(i+1)].onRollOver = rollover;
_root["mc"+(i+1)].onRollOut = rollout;
_root["mc"+(i+1)].onReleaseOutside = rollout;
}
letto = true;
} else {
_root.didascalia.text = "Error al cargar la foto";
}
};
};
leggi();
_root.onMouseMove = function() {
x = _root._xmouse;
y = _root._ymouse;
if (x>pos_iniziale) {
if (y>0 && y<60) {
vel = -(Math.round((y-(larghezzamovie/2))/35));
}
if (y>260 && y<larghezzamovie) {
vel = -(Math.round((y-(larghezzamovie/2))/35));
}
} else {
if (vel>-1) {
vel = 2;
} else {
vel = -2;
}
}
};
function released() {
_root.image = this.big;
_root.box.play();
_root.box.clip_mc.loadMovie(_root.image);
_root.mc_desc.descrizione.text = this.desc;
//_root.selezione._y = (larghezzamovie)/2;
//_root.didascalia.text = this.etichetta.text;
//getURL(percorso,"_blank")
}
function rollover() {
this._alpha = 100;
}
function rollout() {
this._alpha = 50;
}
_root.onEnterFrame = function() {
if (letto) {
for (i=1; i<=nfoto; i++) {
_root["mc"+i]._y += vel;
}
if (vel>0 && _root["mc"+posSin]._y>0) {
_root["mc"+posDes]._y = _root["mc"+posSin]._y-dimImm;
posSin = posDes;
posDes--;
if (posDes == 0) {
posDes = nfoto;
}
}
if (vel<0 && _root["mc"+posSin]._y<=-dimImm) {
_root["mc"+posSin]._y = _root["mc"+posDes]._y+dimImm;
posDes = posSin;
posSin++;
if (posSin>nfoto) {
posSin = 1;
}
}
}
};
Les agradeceria enormemente que me ayudaran a poner un preloader para que se muestre antes de cada imagen "grande" . Mil gracias de antemano por tomarse el tiempo de leer...
Espero respuestas
Valora esta pregunta
0