Groups | Blog | Home
all groups > flash (macromedia) > january 2004 >

flash (macromedia) : working with grid locations


yrus2pid
1/20/2004 10:36:37 PM
I'm creating a game that uses a grid. For each loaction on the grid there is a movie clip with different images on each frame. I want to randomly select the starting picture for each location. I know there is an better way than this:

a1.gotoAndStop(Math.round(random(20)+1));
a2.gotoAndStop(Math.round(random(20)+1));
a3.gotoAndStop(Math.round(random(20)+1));
a4.gotoAndStop(Math.round(random(20)+1));
a5.gotoAndStop(Math.round(random(20)+1));
a6.gotoAndStop(Math.round(random(20)+1));
a7.gotoAndStop(Math.round(random(20)+1));
a8.gotoAndStop(Math.round(random(20)+1));
a9.gotoAndStop(Math.round(random(20)+1));
a10.gotoAndStop(Math.round(random(20)+1));

This would continue with b 1-10, c 1-10 upto k 1-10

urami_
1/21/2004 10:37:16 AM

[quoted text, click to view]


For Loop will be best .

for (i=1; i<=10; i++) {
_root["a"+i].gotoAndStop(Math.round(random(20)+1));
}




Regards


urami_*

<xmas>
http://flashfugitive.com/
yrus2pid
2/1/2004 6:49:28 AM
Thank's
This looks a lot better

AddThis Social Bookmark Button