this should be easy…am i missing something? i have an image gallery, slightly modified from kirupa’s xml image gallery, and for some reason the desc_txt text field isnt filling with the <piece> node from the xml file. everything else works. the text field is set to dynamic text and the instance name is correct (desc_txt). here is the actionscript, can anyone help??
details_mc._visible = false;
border.onRollOver = function() {
details_mc._visible = true;
details_mc._x = _xmouse;
details_mc._y = _ymouse;
startDrag(details_mc);
}
border.onRollOut = function() {
details_mc._visible = false;
stopDrag();
}
///////gallery starts here
spacing = 30;
MovieClip.prototype.resizeMe = function(w, h) {
var speed = 3;
//_root.picture._alpha = 0;
this._width += (w-this._width)/speed;
this._height += (h-this._height)/speed;
if (Math.abs(this._width-w)<1) {
this._width = w;
this._height = h;
//w = 0;
//h = 0;
if (_root.picture._alpha<100) {
_root.picture._alpha += 10;
}
_root.picture._x = this._x-this._width/2+spacing/2;
_root.picture._y = this._y-this._height/2+spacing/2;
}
};
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
piece = [];
link = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
piece* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
link* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("assets/portfolio.xml");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
/////////////////////////////////////
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
//
previous_btn._x = (border._x-border._width/2);
previous_btn._y = (border._y+border._height/2);
next_btn._x = (border._x+border._width/2-next_btn._width);
next_btn._y = (border._y+border._height/2);
//
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
var w = picture._width+spacing;
var h = picture._height+spacing;
border.resizeMe(w, h);
//var sitelink = link[p];
}
};
border.onRelease = function() {
getURL("javascript:Launch('"+sitelink+"', 800, 700)");
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
details_mc.title_txt.text = heading[p];
_root.details_mc.desc_txt.text = piece[p];
picture_num();
sitelink = link[p];
}
} else if (p == (total-1)) {
p = 0;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
details_mc.title_txt.text = heading[p];
_root.details_mc.desc_txt.text = piece[p];
picture_num();
sitelink = link[p];
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
details_mc.title_txt.text = heading[p];
_root.details_mc.desc_txt.text = piece[p];
picture_num();
sitelink = link[p];
} else if (p == 0) {
p = (total-1);
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
details_mc.title_txt.text = heading[p];
_root.details_mc.desc_txt.text = piece[p];
picture_num();
sitelink = link[p];
}
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
details_mc.desc_txt.text = piece[0];
picture_num();
sitelink = link[0];
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
/////////gallery ends here