You're not incrementing imagesToGrab anywhere.

for (...) {
        .....
        imagesToGrab++;
}

Ade

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Corban
Baxter
Sent: 01 February 2006 21:29
To: [email protected]
Subject: [Flashcoders] understanding the for loop


Ok guys I am working with this for loop to help me grab random images. My
problem is it seems like the for loop won't reset and random var each time
it runs. Below is my code...

[code]
for(i=0; i<=imagesToGrab; i++){
        randomSet = random(totalSetsNLayout) + 1;
        img = random(imagesToGrab)+1;
        img = "layout" + layoutNum + "_set" + randomSet + "_img" + i;
        imgArray.push(img);
}
[/code]

imgArray = [
layout5_set1_img0,
layout5_set1_img1,
layout5_set1_img2,
layout5_set1_img3,
layout5_set1_img4,
layout5_set1_img5,
layout5_set1_img6,
layout5_set1_img7,
layout5_set1_img8,
layout5_set1_img9,
layout5_set1_img10,
layout5_set1_img11]

as you can see my problem is that it doesn't change my set randomly at all?
Any ideas why this happens?

Corban Baxter      |      rich media designer      |      www.funimation.com


_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to