Hi, I was wondering if someone could tell me if there is a way to use movie clip instances with FOR loops (yeh I'm not skilled with OOP so I premade mc's instead using loadMovie :<)
for example I made manual SwapDepth function between movieclips, I have hero1_mc, hero2_mc,...,hero6_mc and enemy1_mc,..., enemy12_mc. The code looks something like this:
if (_root.hero1_mc._y > _root.hero2_mc._y) {
tempDepth1 = _root.hero1_mc.getDepth();
tempDepth2 = _root.hero2_mc.getDepth();
if (tempDepth2 > tempDepth1) {
_root.hero1_mc.swapDepths(_root.hero2_mc);
}
}
if (_root.hero1_mc._y > _root.hero3_mc._y) {
tempDepth1 = _root.hero1_mc.getDepth();
tempDepth2 = _root.hero3_mc.getDepth();
if (tempDepth2 > tempDepth1) {
_root.hero1_mc.swapDepths(_root.hero3_mc);
}
}
...
...and so on, code works fine but if I were to write all compares manually it will be thousand lines of code to check each movie clip with each other. o_o
So I was wondering is there any way to put those movie clip instances hero1_mc, hero2_mc... into FOR loop like (code doesn't work, if there could be a way to replace numbers with variables):
for (i=1; i<18; i++) {
for (j=1; j<18; j++) {
if ("_root.hero"+i+"_mc" > "_root.hero"+j+"_mc") {
.......
so I don't have to type all combinations D: so far I haven't found any way to do so, is there any way to make something similar with FOR loop and movie clips? I'm working on my project with AS2.
Thanks in advance!