I’m trying to get more 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>
<otherimages1>photos/bodysuit/large/bs2.jpg</otherimages1>
<otherthumbs1>photos/bodysuit/small/bs2.jpg</otherthumbs1>
<otherimages2>photos/bodysuit/large/bs3.jpg</otherimages2>
<otherthumbs2>photos/bodysuit/small/bs3.jpg</otherthumbs2>
<otherimages3>photos/bodysuit/large/bs4.jpg</otherimages3>
<otherthumbs3>photos/bodysuit/small/bs4.jpg</otherthumbs3>
</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>
<otherimages1>photos/bodysuit/large/bs2.jpg</otherimages1>
<otherthumbs1>photos/bodysuit/small/bs2.jpg</otherthumbs1>
<otherimages2>photos/bodysuit/large/bs3.jpg</otherimages2>
<otherthumbs2>photos/bodysuit/small/bs3.jpg</otherthumbs2>
<otherimages3>photos/bodysuit/large/bs4.jpg</otherimages3>
<otherthumbs3>photos/bodysuit/small/bs4.jpg</otherthumbs3>
</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>
<otherimages1>photos/bodysuit/large/bs2.jpg</otherimages1>
<otherthumbs1>photos/bodysuit/small/bs2.jpg</otherthumbs1>
<otherimages2>photos/bodysuit/large/bs3.jpg</otherimages2>
<otherthumbs2>photos/bodysuit/small/bs3.jpg</otherthumbs2>
<otherimages3>photos/bodysuit/large/bs4.jpg</otherimages3>
<otherthumbs3>photos/bodysuit/small/bs4.jpg</otherthumbs3>
</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>
<otherimages1>photos/bodysuit/large/bs2.jpg</otherimages1>
<otherthumbs1>photos/bodysuit/small/bs2.jpg</otherthumbs1>
<otherimages2>photos/bodysuit/large/bs3.jpg</otherimages2>
<otherthumbs2>photos/bodysuit/small/bs3.jpg</otherthumbs2>
<otherimages3>photos/bodysuit/large/bs4.jpg</otherimages3>
<otherthumbs3>photos/bodysuit/small/bs4.jpg</otherthumbs3>
</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>
<otherimages1>photos/bodysuit/large/bs2.jpg</otherimages1>
<otherthumbs1>photos/bodysuit/small/bs2.jpg</otherthumbs1>
<otherimages2>photos/bodysuit/large/bs3.jpg</otherimages2>
<otherthumbs2>photos/bodysuit/small/bs3.jpg</otherthumbs2>
<otherimages3>photos/bodysuit/large/bs4.jpg</otherimages3>
<otherthumbs3>photos/bodysuit/small/bs4.jpg</otherthumbs3>
</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>
<otherimages1>photos/bodysuit/large/bs2.jpg</otherimages1>
<otherthumbs1>photos/bodysuit/small/bs2.jpg</otherthumbs1>
<otherimages2>photos/bodysuit/large/bs3.jpg</otherimages2>
<otherthumbs2>photos/bodysuit/small/bs3.jpg</otherthumbs2>
<otherimages3>photos/bodysuit/large/bs4.jpg</otherimages3>
<otherthumbs3>photos/bodysuit/small/bs4.jpg</otherthumbs3>
</pic>
</images>
ActionScript:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
category = [];
title = [];
image = [];
description = [];
thumbnails = [];
price = [];
sizes = [];
otherimages = [];
otherthumbs = [];
otherimages1 = [];
otherthumbs 1= [];
otherimages2 = [];
otherthumbs2 = [];
otherimages3 = [];
otherthumbs3 = [];
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;
otherthumbs* = xmlNode.childNodes*.childNodes[8].firstChild.nodeValue;
otherimages1* = xmlNode.childNodes*.childNodes[9].firstChild.nodeValue;
otherthumbs1* = xmlNode.childNodes*.childNodes[10].firstChild.nodeValue;
otherimages2* = xmlNode.childNodes*.childNodes[11].firstChild.nodeValue;
otherthumbs2* = xmlNode.childNodes*.childNodes[12].firstChild.nodeValue;
otherimages3* = xmlNode.childNodes*.childNodes[13].firstChild.nodeValue;
otherthumbs3* = xmlNode.childNodes*.childNodes[14].firstChild.nodeValue;
}
//firstImage();
_root.picture.loadMovie(“movie.swf”);
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(“active.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];
thumbnails_fn1(k) /////// i am calling the second function here it display the first image when i click the thumbnail. once i click the second thumbnail second image is appending.
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._heig ht)) {
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 thumbNailScroller1() {
// thumbnail code!
this.createEmptyMovieClip(“tscroller”, 1000);
scroll_speed = 10;
tscroller.onEnterFrame = function() {
if ((_root._xmouse>=thumbnail_mc1._x) && (_root._xmouse<=thumbnail_mc1._x+thumbnail_mc1._height)) {
if ((_root._ymouse>=(hit_bottom._y-40)) && (thumbnail_mc1.hitTest(hit_bottom))) {
thumbnail_mc1._y -= scroll_speed;
} else if ((_root._ymouse<=(hit_top._y+40)) && (thumbnail_mc1.hitTest(hit_top))) {
thumbnail_mc1._y += scroll_speed;
}
} else {
delete tscroller.onEnterFrame;
}
};
}
function thumbnails_fn1(k) {
//thumbnail_mc1.loadMovie("");
thumbnail_mc1.createEmptyMovieClip(“t”+k, thumbnail_mc1.getNextHighestDepth());
//thumbnail_mc1.createEmptyMovieClip(“t1”+k+1, thumbnail_mc1.getNextHighestDepth());
slistener = new Object();
slistener.onLoadInit = function(target_mc1) {
target_mc1._y = hit_top._x+(target_mc._width+5)*k;
target_mc1.pictureValue = k;
target_mc1.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};
target_mc1.onRollOver = function() {
this._alpha = 50;
thumbNailScroller1();
};
target_mc1.onRollOut = function() {
this._alpha = 100;
};
};
image1_mcl = new MovieClipLoader();
image1_mcl.addListener(slistener);
image1_mcl.loadClip(thumbnails1[k], "thumbnail_mc1.t"+k);
//image_mc2 = new MovieClipLoader();
//image_mc2.addListener(tlistener);
//image1_mc1.loadClip(thumbnails1[k+1], "thumbnail_mc1.t"+k);
}
If you can help that would be great!