Hola amigos, quisiera hacerles una consulta que me ha tenido mucho tiempo y no he podido realizar :( (todo mal).
He querido hacer una gallería tomando como una base de código en la red .
Todo va bien, hasta cuando tengo que asignarle las acciones a los botones(en especial la accion del boton sostenido) :(
Yo hasta el momento he podido hacer que tengan los 3 estados(rollOver, Out, y Release) pero lo que me tiene super complicado y aflijido de todo esto es no poder contar con el estado presionado del botón de un thumbnail. que para mi es super importante :(
Para realizar los estados simples creé un boton simple(llamado BOTON_SECCIONES) y lo ataché de la librería a los thumbs.
Muchas gracias de antemano compañeros por su tiempo.
Saludos
*el Code
Código:
stop();
import mx.transitions.*;
import mx.transitions.easing.*;
p=0
//columnas
var columnas = 1
//separacion
var separacionVertical = 0
//separacion
var separacionHorizontal = 0
var picture = _root.picture
function loadXML(loaded) {
if (loaded) {
// xmlNode = this.firstChild;
xmlNode = this.firstChild.childNodes[0].childNodes;
image = [];
thumbnails = [];
total = xmlNode.length;
for (i=0; i<total; i++) {
// image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
image[i] = xmlNode[i].childNodes[0].firstChild.nodeValue;
// description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
// thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
thumbnails[i] = xmlNode[i].childNodes[1].firstChild.nodeValue;
thumbnails_fn(i);
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("XMLs/ALL_FOTOS_02.xml");
/////////////////////////////////////
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 10;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
}
}
/////////////////////////////////////
//THUMBNAILS
function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
// target_mc._x =(target_mc._width+separacionHorizontal)*(k%columnas);
target_mc._y =(target_mc._height+separacionVertical)* Math.floor(k/columnas)
target_mc.pictureValue = k;
atacharroll = thumbnail_mc.attachMovie("BOTON_SECCIONES","BOTON_SECCIONES"+k, thumbnail_mc.getNextHighestDepth());
// atacharroll._x = (target_mc._width+separacionHorizontal)*(k%columnas);
atacharroll._y = target_mc._y =(target_mc._height+separacionVertical)* Math.floor(k/columnas)
target_mc.onRollOver = function() {
container = this._parent["BOTON_SECCIONES"+k];
container.gotoAndStop(2);
};
target_mc.onRollOut = function() {
container = this._parent["BOTON_SECCIONES"+k];
container.gotoAndStop(1);
};
target_mc.onRelease = function() {
container = this._parent["BOTON_SECCIONES"+k];
container.gotoAndStop(3);
p = this.pictureValue-1;
nextImage();
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}
* el XML
Código:
<?xml version='1.0' encoding='iso-8859-1' standalone="yes"?>
<IMAGES>
<slide_01 title="SLIDE_01">
<pic>
<image>Fotos/01a.jpg</image>
<thumbnails>Fotos/thumbs/01aa.gif</thumbnails>
</pic>
<pic>
<image>Fotos/01b.jpg</image>
<thumbnails>Fotos/thumbs/01bb.gif</thumbnails>
</pic>
</slide_01>
<slide_02 title="SLIDE_02">
<pic>
<image>Fotos/02a.jpg</image>
<thumbnails>Fotos/thumbs/02a.gif</thumbnails>
</pic>
<pic>
<image>Fotos/02b.jpg</image>
<thumbnails>Fotos/thumbs/02b.gif</thumbnails>
</pic>
</slide_02>