Jason so its bad to use this old way of random huh? Corban Baxter | rich media designer | www.funimation.com
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: Wednesday, February 01, 2006 3:51 PM To: Flashcoders mailing list Subject: RE: [Flashcoders] understanding the for loop >> img = random(imagesToGrab)+1; Yeah - first part of is probably that your use of random is... well... incorrect. Math.random() retruns a random number of 0.0 or between 0.0 and 1.0. You should convert it to a whole number first. function getRandom(min:Number, max:number){ return min+Math.floor(Math.random()*(max+1-min)); } The other part is that you're overwriting the img variable: img = random(imagesToGrab)+1; img = "layout" + layoutNum + "_set" + randomSet + "_img" + i; So in effect, the first value of img is replaced in the second line. Jason Merrill | E-Learning Solutions | icfconsulting.com NOTICE: This message is for the designated recipient only and may contain privileged or confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of this e-mail by you is prohibited. _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders