I’m trying to get two thumbnail movieclips on the same page to display two different arrays of pictures. It’s not working though and I’m not sure why, could someone please look at my xml and ActionScript and see what I’m doingwrong. I’ve been at this for a few hours now and I can’t see whats wrong. Please help!
XML:
<?xml version=“1.0” encoding=“utf-8” standalone=“yes”?>
<images>
<pic>
<category>Bodysuit</category>
<name>Body Suit 1</name>
<description>Body Suit 1 description.</description>
<mainimage>photos/bodysuit/large/bs1.jpg</mainimage>
<mainthumb>photos/bodysuit/small/bs1.jpg</mainthumb>
<price>$00.00</price>
<sizes>0 - 0</sizes>
<otherimages>photos/bodysuit/large/bs1.jpg</otherimages>
<otherthumbs>photos/bodysuit/small/bs1.jpg</otherthumbs>
</pic>
<pic>
<category>Bodysuit</category>
<name>Body Suit 2</name>
<description>Body Suit 2 description.</description>
<mainimage>photos/bodysuit/large/bs2.jpg</mainimage>
<mainthumb>photos/bodysuit/small/bs2.jpg</mainthumb>
<price>$00.00</price>
<sizes>0 - 0</sizes>
<otherimages>photos/bodysuit/large/bs2.jpg</otherimages>
<otherthumbs>photos/bodysuit/small/bs2.jpg</otherthumbs>
</pic>
<pic>
<category>Bodysuit</category>
<name>Body Suit 3</name>
<description>Body Suit 3 description.</description>
<mainimage>photos/bodysuit/large/bs3.jpg</mainimage>
<mainthumb>photos/bodysuit/small/bs3.jpg</mainthumb>
<price>$00.00</price>
<sizes>0 - 0</sizes>
<otherimages>photos/bodysuit/large/bs3.jpg</otherimages>
<otherthumbs>photos/bodysuit/small/bs3.jpg</otherthumbs>
</pic>
<pic>
<category>Bodysuit</category>
<name>Body Suit 4</name>
<description>Body Suit 4 description.</description>
<mainimage>photos/bodysuit/large/bs4.jpg</mainimage>
<mainthumb>photos/bodysuit/small/bs4.jpg</mainthumb>
<price>$00.00</price>
<sizes>0 - 0</sizes>
<otherimages>photos/bodysuit/large/bs4.jpg</otherimages>
<otherthumbs>photos/bodysuit/small/bs4.jpg</otherthumbs>
</pic>
<pic>
<category>Bodysuit</category>
<name>Body Suit 5</name>
<description>Body Suit 5 description.</description>
<mainimage>photos/bodysuit/large/bs5.jpg</mainimage>
<mainthumb>photos/bodysuit/small/bs5.jpg</mainthumb>
<price>$00.00</price>
<sizes>0 - 0</sizes>
<otherimages>photos/bodysuit/large/bs5.jpg</otherimages>
<otherthumbs>photos/bodysuit/small/bs5.jpg</otherthumbs>
</pic>
<pic>
<category>Bodysuit</category>
<name>Body Suit 6</name>
<description>Body Suit 6 description.</description>
<mainimage>photos/bodysuit/large/bs6.jpg</mainimage>
<mainthumb>photos/bodysuit/small/bs6.jpg</mainthumb>
<price>$00.00</price>
<sizes>0 - 0</sizes>
<otherimages>photos/bodysuit/large/bs6.jpg</otherimages>
<otherthumbs>photos/bodysuit/small/bs6.jpg</otherthumbs>
</pic>
<pic>
<category>Bodysuit</category>
<name>Body Suit 7</name>
<description>Body Suit 7 description.</description>
<mainimage>photos/bodysuit/large/bs7.jpg</mainimage>
<mainthumb>photos/bodysuit/small/bs7.jpg</mainthumb>
<price>$00.00</price>
<sizes>0 - 0</sizes>
<otherimages>photos/bodysuit/large/bs7.jpg</otherimages>
<otherthumbs>photos/bodysuit/small/bs7.jpg</otherthumbs>
</pic>
<pic>
<category>Bodysuit</category>
<name>Body Suit 8</name>
<description>Body Suit 8 description.</description>
<mainimage>photos/bodysuit/large/bs8.jpg</mainimage>
<thumbnail>photos/bodysuit/small/bs8.jpg</thumbnail>
<price>$00.00</price>
<sizes>0 - 0</sizes>
<otherimages>photos/bodysuit/large/bs8.jpg</otherimages>
<otherthumbs>photos/bodysuit/small/bs8.jpg</otherthumbs>
</pic>
</images>
ActionScript:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
category = [];
title = [];
image = [];
description = [];
thumbnails = [];
price = [];
sizes = [];
otherimages = [];
otherthumbs = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
category* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
title* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
image* = xmlNode.childNodes*.childNodes[3].firstChild.nodeValue;
thumbnails* = xmlNode.childNodes*.childNodes[4].firstChild.nodeValue;
thumbnails_fn(i);
price* = xmlNode.childNodes*.childNodes[5].firstChild.nodeValue;
sizes* = xmlNode.childNodes*.childNodes[6].firstChild.nodeValue;
otherimages* = xmlNode.childNodes*.childNodes[7].firstChild.nodeValue;
//otherimages_fn(i);
otherthumbs* = xmlNode.childNodes*.childNodes[8].firstChild.nodeValue;
otherthumbs_fn(i);
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(“images2.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;
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);
desc_txt.text = description[p];
price_txt.text = price[p];
sizes_txt.text = sizes[p];
title_txt.text = title[p];
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p–;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
price_txt.text = price[p];
sizes_txt.text = sizes[p];
title_txt.text = title[p];
picture_num();
}
}
function firstImage() {
if (loaded == filesize){
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
price_txt.text = price[0];
sizes_txt.text = sizes[0];
title_txt.text = title[0];
picture_num();
}
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
function thumbNailScroller() {
// thumbnail code!
this.createEmptyMovieClip(“tscroller”, 1000);
scroll_speed = 10;
tscroller.onEnterFrame = function() {
if ((_root._ymouse>=thumbnail_mc._y) && (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) {
if ((_root._xmouse>=(hit_right._x-40)) && (thumbnail_mc.hitTest(hit_right))) {
thumbnail_mc._x -= scroll_speed;
} else if ((_root._xmouse<=(hit_left._x+40)) && (thumbnail_mc.hitTest(hit_left))) {
thumbnail_mc._x += scroll_speed;
}
} else {
delete tscroller.onEnterFrame;
}
};
}
function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip(“t”+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = hit_left._x+(target_mc._width+5)*k;
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};
target_mc.onRollOver = function() {
this._alpha = 50;
thumbNailScroller();
};
target_mc.onRollOut = function() {
this._alpha = 100;
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}
function otherthumbs_fn(l) {
thumbnail_mc1.createEmptyMovieClip(“s”+l, thumbnail_mc1.getNextHighestDepth());
slistener = new Object();
slistener.onLoadInit = function(target_mc_1) {
target_mc_1._x = hit_left1._x+(target_mc_1._width+5)*l;
target_mc_1.pictureValue = l;
target_mc_1.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};
target_mc_1.onRollOver = function() {
this._alpha = 50;
// thumbNailScroller();
};
target_mc_1.onRollOut = function() {
this._alpha = 100;
};
};
image_mcl_1 = new MovieClipLoader();
image_mcl_1.addListener(slistener);
image_mcl_1.loadClip(otherthumbs[l], "thumbnail_mc1.s"+l);
}
If you can help that would be great!