Two variables in a for loop

[font=Arial]Can anyone help with this; I have tried several ways but does not work.[/font]

[color=black][font=Arial]The first for loop creates the numbers to collect the correct tag in my xml file, that works, but I need a second variable in the for loop to select my random Array numbers [0][1][2][3]…[/font][/color]

here is the code, the code in red is the script im trying to work out

MyArray = [4, 5, 6, 7, 8];
function shuffleArray() {
return Math.round(Math.random());
for (var i = 4; i < 9; i++; [color=red]var e = 0; e < 5; e++)[/color][color=black]{[/color]
[color=red]spread = myArray[e];[/color]

questionClip.attachMovie(“RandomAnswer”, “containeranswer”+i, i);
questionClip[“containeranswer”+i]._y = 0+((i*15)-34);
questionClip[“containeranswer”+i]._x = 95;
questionClip[“containeranswer”+i].ranAnswer = questionsArray[currentQuestion].[color=red]answers[spread];[/color]


you could use dual for loops… one w/ i, one w/ e… you are getting an error when you check your code, right?


yea sure are getting an error, its doing my head in

gues you are trying to do a question/answer type thing. You might be better putting the questions/ answers in the same array and then shuffling it. Not sure exactly how you are making your movie but have a look at this.

the reason that you are getting an error message is b/c you can’t have 2 variables in a for loop.


You sure can have 2+ variables within the [font=courier new]for[/font] statement. :wink:

for (var i = 4, e = 0; i<9; i++, e++) {
//do your stuff