-
Senior Member
function - several mc:s
I have a function with several functions like this:
letafel(spel.b1);
letafel(spel.b2);
letafel(spel.b3);
letafel(spel.b4);
letafel(spel.b5);
Can I make this code more simple by some kind of "grouping"?
Mattias Gordon
illustrator/ animator
-
how about you loop it and have inside the loop
where z is the variable in the loop, (assuming the z starts with one if z starts wiht 0 you will need (z+1) instead of z.
letafel(spel["b"+z]);
I think that should work.
this is something I used
Actionscript Code:
for (var z = 0; z<9; z++) { idb.createEmptyMovieClip("is0"+(z+1), (z+2)); } for (var w = 9; w<14; w++) { idb.createEmptyMovieClip("is"+(w+1), (w+2)); }
basically i creates 14 empty movie clips called is01 - is09 and is 10 - is14. is standing for itemslot. Sadly I had to add the 01 and not is1, because later on in my code i sub str the is09 to get 09, converted it to a number (increase i got 13 i didn't want to cut of the 0 in 09, or the 1 in 13), so i was left with 9, or 13 and used it in my array. Just a way i set up an on release button withing a loop.
anyways I hope that helped
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|