Answered
targeting using a substring
I have an mc on the stage called car_mc which contains
various mc's that are named:
spkr-a-0_mc
spkr-a-1_mc
spkr-a-2_mc
spkr-b-0_mc
spkr-b-1_mc
what i was trying to do is only target the substring "a" then have it perform an action, below is my script thats not working:
for (obj in car_mc) {
trace(obj);
//spkr-a-1_mc
if (typeof (car_mc[obj]) == "movieclip" and car_mc[obj]._name.substring(4, car_mc[obj]._name.indexOf("-")) == "a"){
car_mc[obj].play();
}
}
spkr-a-0_mc
spkr-a-1_mc
spkr-a-2_mc
spkr-b-0_mc
spkr-b-1_mc
what i was trying to do is only target the substring "a" then have it perform an action, below is my script thats not working:
for (obj in car_mc) {
trace(obj);
//spkr-a-1_mc
if (typeof (car_mc[obj]) == "movieclip" and car_mc[obj]._name.substring(4, car_mc[obj]._name.indexOf("-")) == "a"){
car_mc[obj].play();
}
}
