Question:
I have the following piece of script. Works like charm, and why should it not.
_root.card1.but.onRelease = function() {
_root.card1.gotoAndStop(2);
if (_root.firstcard==""){
_root.firstcard=1;
} else if (_root.secondcard==""){
_root.secondcard=1;
}
}
The thing is, i have to ad this script to 55 more buttons. (_root.card2.but, _root.card3.but, etc) Instead of making 56 of the scripts, I tried to use a for loop. This is the loop I used.
for (i=1; i<=56; i++){
_root[“card”+i].but.onRelease = function() {
_root[“card”+i].gotoAndStop(2);
if (_root.firstcard==""){
_root.firstcard=i;
} else if (_root.secondcard==""){
_root.secondcard=i;
}
}
}
But it does not seem to work. Can anybody lend me a hand?
Thanks!