Next&Previous - One more time :)

Ok so I’ve been battling with this code for 2 days now. I simplified my post and deleted my other thread.

Hopefully 3rd time’s a charm:)

Here goes


//temp assuming DefaultValue1 is being passed to flash
// which it will be if this was published
DefaultValue1 = "House1.jpg::Taken 2-20-05~House2.jpg::Taken2-21-05~House3.jpg::Taken 2-22-05~House4.jpg::Taken2-23-05~House5.jpg::Taken 2-24-05~House6.jpg::Taken2-25-05~House7.jpg::Taken 2-26-05~House8.jpg::Taken 2-20-05";
DefaultValue2 = "110 E. Pershing Ave.~~1598 Vinehill Circle~129Oldfield Road~9817 Nw 64th Place~10 S 511 Thames Drive~6 QueensWay~937 Loxford Terrace~7 Dundee Court~96-05 72nd Road~39 BoyceAvenue~83 Nippon Avenue~140 S Middle Neck Road";
// end temp
var receivedData = {photos:new Array(), texts:new Array(), folders:new Array(), captions:new Array()};
function Parse() {
    var temp1 = DefaultValue1.split("~");
    for (var i = 0; i<temp1.length; ++i) {
        var temp2 = temp1*.split(":");
        receivedData.photos.push(temp2[0]);
        receivedData.folders.push(temp2[1]);
        receivedData.texts.push(temp2[2]);
    }
    var temp3 = DefaultValue2.split("~");
    for (var j = 0; j<temp3.length; j++) {
        receivedData.captions.push(temp3[j]);
    }
    titleNum.text = receivedData.texts.length;
}
Parse();
function loadPics() {
    position = 0;
    trace(position);
    count = 6;
    var currentChunk = receivedData.photos.slice(position*count, position*count+count);
    trace(currentChunk);
    // where 0 is first "positioin" and count is how many to display for each
    var columns = 3;
    var menu = this.createEmptyMovieClip("menu", 99);
    menu._x = 15;
    menu._y = 75;
    for (var i = 0; i<6; i++) {
        var item = menu.createEmptyMovieClip("item"+i, i);
        item._x = (i%columns)*195;
        item._y = Math.floor(i/columns)*150;
        item.attachMovie("mc", "mc", 1);
        var columns = 3;
        var imageContainer = this.createEmptyMovieClip("imageContainer", 101);
        imageContainer._x = 16;
        imageContainer._y = 76;
        var columns = 3;
        var imageContainer = this.createEmptyMovieClip("imageContainer", 101);
        imageContainer._x = 16;
        imageContainer._y = 76;
        for (var k = 0; k<6; k++) {
            nextBtn.onPress = function() {
                /*
                                       _global.position=_global.position+1;
                                       trace(_global.position);
                                       loadPics();
                                       */
                position++;
                count++;
                var currentChunk = receivedData.photos.slice(position*count, position*count+count);
                myContainer.file = receivedData.photos[k];
                //myConatiner.file2 = receivedData.photos.slice(position*6,position*6+6);
                myContainer.holder.loadMovie(myContainer.file);
                trace(position);
                loadPics();
            };
            var myContainer = imageContainer.createEmptyMovieClip("containerItem"+k, k);
            myContainer._x = (k%columns)*195;
            myContainer._y = Math.floor(k/columns)*150;
            myContainer.attachMovie("container", "container", 1);
            myContainer.createEmptyMovieClip("holder", 2);
            myContainer.baseImgNum = ((currPageNum-1)*imgPerPage)+1;
            myContainer.file = receivedData.photos[k];
            myContainer.title = receivedData.texts[k];
            myContainer.caption = receivedData.captions[k];
            myContainer.holder.loadMovie(myContainer.file);
            myContainer.onPress = function() {
                loadMovie(this.file, "imgHolder");
                imgHolder._xscale = 44;
                imgHolder._yscale = 44;
                imgName.text = this.file;
                imgTitle.text = this.title;
                imgCaptions.text = this.caption;
                trace(this.file+newline+this.caption);
                trace(baseImgNum);
            };
            myContainer._yscale = 22.3;
            myContainer._xscale = 22.3;
        }
    }
}
loadPics();
position = 0;
tempVar = receivedData.photos.slice(position*6, position*6+6);
trace(tempVar);

At this point I either need to figure this out or find another option.

I need to display the 1st 6 items in my array and on press of the next button i need to display the next 6.

THANKS!