var AmountPic:Number = 2;
var picList = new Array();
var currentElement:Number = 0;
for(i=0; i < AmountPic; i++ ) {
var destination:String = "gal" + (i+1) + ".swf";
picList.push(destination);
}
stuff_mc.loadMovie(picList[currentElement]);
neste.onRelease = function() {
if (currentElement < picList.length-1) {
currentElement++;
}
else {
currentElement = 0;
}
stuff_mc.loadMovie(picList[currentElement]);
}
When I come to the last element in the index I want it to go to the first index again, thats what the code in "neste.onRelease = function()" do. But i don't understand the first part with
if (currentElement < picList.length-1) {
currentElement++;
}
Question
Tamilboy86
var AmountPic:Number = 2; var picList = new Array(); var currentElement:Number = 0; for(i=0; i < AmountPic; i++ ) { var destination:String = "gal" + (i+1) + ".swf"; picList.push(destination); } stuff_mc.loadMovie(picList[currentElement]); neste.onRelease = function() { if (currentElement < picList.length-1) { currentElement++; } else { currentElement = 0; } stuff_mc.loadMovie(picList[currentElement]); }When I come to the last element in the index I want it to go to the first index again, thats what the code in "neste.onRelease = function()" do. But i don't understand the first part with
if (currentElement < picList.length-1) { currentElement++; }picList.length-1.. why "-1" ?
thx
Link to comment
Share on other sites
5 answers to this question
Recommended Posts