Alright im making a risk game and i have it set up so far so that you can drag little army pieces and put them on a country which then makes the power of that country go up.
when i try and use a for loop, it only enables the last button it goes through (army5).
If i use an onEnterFrame loop, its too slow.
I need a loop that will loop all the buttons (may get around 100) and make them all available to be used with onRelease. This is what i have so far.
"arm" is for the army pieces.
"armm" is for the country movie clips.
PHP Code:
for (arm=1; arm<=5; arm++) {
armm = eval("army"+arm);
trace(armm);
armm.onPress = function() {
this.startDrag();
};
armm.onRelease = function() {
this.stopDrag();
for (i=1; i<=6; i++) {
if (this.hitTest(eval("m"+i))) {
armm._x = eval("m"+i+"._x");
armm._y = eval("m"+i+"._y");
y = eval("m"+i);
y.p += 1;
}
}
};
}