Im building a flash portfolio/slideshow using XML to dynamically load external .swfs.
The problem is with gettingthe .swfs( displayed in a center slider ) to display themselves in a loop...
I think it starts with comparing the length of the childnodes with the numbered ID attribute - to see if its come to the last one - and then reset the node atribute to loop, in order to display the beginning to the sequence.
Im not sure of the logic/syntax to resolve.
for example, there might be 5 swfs to display in sequence. The movie clip they are displayed in has spaces for 12 images, so id like the first 5 images to repeat, by loop to fill up the spaces.
//start XML object
testXML = new XML();
testXML.ignoreWhite = true;
testXML.load ("portfolio_list_category.xml");
testXML.onLoad = startSlideShow;
function startSlideShow(success)
{
if (success == true)
{
rootNode = testXML.firstChild; // this is the 'DDGportfolio' from XML...same as output_XMLroot =this.firstChild.nodeName;
totalCategories = rootNode.childNodes.length;
firstCategory = rootNode.childNodes[0].attributes.name;
currentCategory = firstCategory;
//nextCategory = rootNode.firstChild.nextSibling;
currentcategoryIndex = 1;
updateCategory(firstCategory);
categoryPortfolioitems = rootNode.firstChild.childNodes.length;// counts portfolio items total within category
firstSlideNode = rootNode.childNodes[0]. firstChild;
currentSlideNode = firstSlideNode;
currentIndex = 1;
updateSlide(firstSlideNode);
nextSlide = rootNode.firstChild.childNodes[j].attributes.jpegURL;
} else {
output += "Loading Error!";
}
}
//
function updateSlide(newSlideNode){
//use VAR j to count# of nodes (ie the last node)
for(var j = 0; j<rootNode.firstChild.childNodes.length; j++){
trace (j + " nodeinfo = "+rootNode.firstChild.childNodes[j].attributes.jpegURL+ " var info C = "+ C +" var showItemID value= "+showItemID);
var c = 0;
//use showItemID to synch ID attribute in XML with VAR j (measures # of nodes, to cause end of nodes to loop)
showItemID = rootNode.childNodes[0].lastChild.attributes.id;
//if (showItemID = undefined) {showItemID=0};
//if (showItemID == j) {startshowItemLoop = "true"};
nextimagePath = rootNode.childNodes[0];
//loadMovie(imagePath, scrollBox.sliderClip.previewClip1);
//if (startshowItemLoop = "true"){};
if (showItemID !== j) {startshowItemLoop = 1}
if (showItemID == j) {startshowItemLoop = 0}
// below are the original previews
loadMovie(imagePath, previewClip);
loadMovie(imagePath, targetClip);
} // End of the function
// thing to select category from xml and display corresponding content
// end of
// control for 'Next' button
next_category_btn.onRelease = function ()
{
_root.alert = ""; //this compares the current slide with the total number of slides in its category
if (currentIndex == (categoryPortfolioitems-1)) // -1 in order to keep count synchronized.