Hi. Ive used the following code to import XML thumbnails into a page flip app in Flash.
I want to script it so when the thumbnail for a certain page is clicked on the page flip will go to that page.
The code below, in its current state will always go to page 1 no matter what thumbnail is clicked.
How can i script it so if thumbnail 3 is clicked it goes to page 3 etc etc etc??
descriptions=true;
alert._visible=false;
var ease = 5;
thumbs = new XML();
thumbs.ignoreWhite=true;
thumbs.load(“thumbs.xml”);
thumbs.onLoad=function() {
root=this.firstChild;
total=root.childNodes.length;
displayNum=Number(root.childNodes[0].attributes.displayNum);
separation=Number(root.childNodes[0].attributes.separation);
//settings
w=Number(root.childNodes[0].attributes.w);
h=Number(root.childNodes[0].attributes.h);
mask._width=displayNum*(w+separation);
mask._height=h+10;
forward._x=mask._width+20;
forward._y=back._y=h/2;
mcs=[];
for (i=0;i<total;i++) {
mcs.push(i);
newThumb=thumbnailer.container.duplicateMovieClip( “container”+i,i);
with (newThumb) {
_x=(w+separation)i;
preloader._x=w/2;
preloader._y=h/2;
shape._width=w;
shape._height=h;
}
var image=root.childNodes.childNodes[0].firstChild.nodeValue;
newThumb.desc=root.childNodes*.childNodes[1].firstChild.nodeValue;
newThumb.cont.loadMovie(image);
newThumb.onRelease=function() {
_parent.gotoPage(1);
}
if (descriptions) {
newThumb.onRollOver=function() {
alert.desc=this.desc;
alert._visible=true;
}
newThumb.onRollOut=function() {
alert._visible=false;
}
}
}
//
var offset=total-1;
var dest=0;
var increment=w+separation;
var ending=(total-displayNum)*(w+separation);
var lastmc=total-1;
var firstmc=0;
back.onRelease = function() {
if (dest<0) {
dest += increment;
} else {
first=mcs[0];
for(k=0;k<total;k++) {
mcs[k]=mcs[k+1];
}
mcs[total-1]=first;
thumbnailer["container"+lastmc]._x=-(w+separation);
firstmc=lastmc;
//check whos new lastmc
for(k=0;k<total;k++) {
if (mcs[k]==(total-1)) {
lastmc=k;
}
}
}
}
forward.onRelease = function() {
if (dest>-ending) {
dest -= increment;
} else {
last=mcs[total-1];
for(k=1;k<total;k++) {
mcs[total-k]=mcs[total-k-1];
}
mcs[0]=last;
thumbnailer["container"+firstmc]._x=(displayNum)*(w+separation);
lastmc=firstmc;
//check whos new firstmc
for(k=0;k<total;k++) {
if (mcs[k]==0) {
firstmc=k;
}
}
}
}
//movement
onEnterFrame = function () {
for (j=0;j<total;j++) {
thumbnailer["container"+j]._x += (dest+(mcs[j])*(w+separation)-thumbnailer["container"+j]._x)/ease;
}
alert._x=_xmouse;
alert._y=_ymouse;
}
}