I will break it down in parts, image gallery with main image loader, thumbnails, title, size and description (this is the part I am having problems with) and menu options for different galleries. The resize function is not passing id to text fields even though it is traceable.
Here is the as:
var tnNr;
spacing = 10;
container._alpha = 0;
var curLength;
MovieClip.prototype.loadPic = function(pic, id) {
info.text = "";
info2.text = "";
info3.text = "";
info4.text = "";
this._alpha = 0;
this.loadMovie(pic);
temp = this._parent.createEmptyMovieClip("temp2", 998);
temp.onEnterFrame = function() {
var t = container.getBytesTotal(), l = container.getBytesLoaded();
if (Math.round(l/t) == 1 && container._width != 0 && container._height != 0) {
var w = container._width+spacing, h = container._height+spacing;
border.resizeMe(w, h, id);
delete this.onEnterFrame;
}
};
};
MovieClip.prototype.resizeMe = function(w, h, id) {
var speed = 3;
container._alpha = 0;
this.onEnterFrame = function() {
this._width += (w-this._width)/speed;
this._height += (h-this._height)/speed;
if (Math.abs(this._width-w)<1 && Math.abs(this._height-h)<1) {
this._width = w;
this._height = h;
container._x = this._x-this._width/2+spacing/2;
container._y = this._y-this._height/2+spacing/2;
container._alpha += 5;
if (container._alpha>90) {
info.text = id;
info2.text = sArray[this.id];
info3.text = cArray[this.id]; //////why do I get undefined for these even though info is traceable?
info4.text = (aArray[this.id];
container._alpha = 100;
delete this.onEnterFrame;
trace(aArray);///this will return the correct fields of information for all Arrays
}
}
};
};
loading them up XML
function galleryChoice(q) {
pArray = new Array();
tArray = new Array();
iArray = new Array();
sArray = new Array();
cArray = new Array();
aArray = new Array();
my_xml = new XML();
for (var j = 0; j<curLength; j++) {
this.scroll.th_nav["thmb"+j].removeMovieClip();
}
my_xml.ignoreWhite = true;
my_xml.onLoad = function(loaded) {
if (loaded) {
gallery = this.firstChild.childNodes[q];
curLength = gallery.childNodes.length;
for (var i = 0; i<gallery.childNodes.length; i++) {
pArray.push(gallery.childNodes*.attributes.source);
tArray.push(gallery.childNodes*.attributes.thumb);
iArray.push(gallery.childNodes*.attributes.title);
sArray.push(gallery.childNodes*.attributes.size);
cArray.push(gallery.childNodes*.attributes.created);
aArray.push(gallery.childNodes*.attributes.avail);
}
}
delay = setInterval(makeButtons, 50);
};
my_xml.load("docs/gallery.xml");
}
Here is the function for buttons
function activateButtons() {
mainButtons();
for (var i = 0; i<pArray.length; i++) {
var but = scroll.th_nav["thmb"+i];
but.id = i;
but.onRelease = function() {
container.loadPic(pArray[this.id], iArray[this.id], sArray[this.id], cArray[this.id], aArray[this.id]);
disButtons2(this.id);
trace(aArray[this.id]); ////all return correct when hitting button
};
}
container.loadPic(pArray[0], iArray[0], sArray[0], cArray[0], aArray[0 );
disButtons2(0);
/*
trace(pArray[0]);///All return correct
trace(iArray);
trace(sArray);
trace(cArray);
trace(aArray);*/
}
Now what I dont get. Everything works except that on load. image and title are passed to correct fields however the other 3 text fields return undefined even though they are all traceable when i trace them. What am I doing wrong when I am setting these 3 text fields?
Any help is appreciated.