try pushing your xml nodes into an associative array -
use List Variables to show how the array is compiledCode:arr = new Array(); xmlPhotos.onLoad = function() { for (var i:Number = 0; i<xmlPhotos.firstChild.childNodes.length; i++) { var initThumb:Object = new Object(); initThumb.photo = (xmlPhotos.firstChild.childNodes[i].attributes.photo); initThumb.titre = (xmlPhotos.firstChild.childNodes[i].childNodes[0].firstChild); initThumb.count = (xmlPhotos.firstChild.childNodes[i].childNodes[1].firstChild); arr.push(initThumb); }
use your counter to loop through the array -
untested, but the logic is soundCode:var premierPic:Number = 0; initThumb.onRelease = function() { trace(arr[premierPic].photo); mcLargePhoto.loadMovie("images/travel/"+arr[premierPic].photo); txtCount.text = this.count; txtDesc.text = this.titre; mcScroller._alpha = 0; };
EDIT - object moved to inside of loop





Reply With Quote