rockstardub
Programmer
I have a problem, I need to learn how to make my code more reusable, heres what I'm working with:
I made an attempt by trying this, but I can't get it to work, or any other form of it.
Please Help!
Thanks,
Rockstar
Code:
if(_root.news_select == 1) {
if(homenews.topic2._currentframe == 10) { //if it's red
homenews.topic2.play();
}
if(homenews.topic1._currentframe == 1) { //if it's black
homenews.topic1.play();
}
if(homenews.topic3._currentframe == 10) { //if it's red
homenews.topic3.play();
}
} else if(_root.news_select == 2) {
trace(TCurrentLabel(homenews.topic1));
if(homenews.topic1._currentframe == 10) { //if it's red
homenews.topic1.play();
}
if(homenews.topic2._currentframe == 1) { //if it's black
homenews.topic2.play();
}
if(homenews.topic3._currentframe == 10) { //if it's red
homenews.topic3.play();
}
} else if(_root.news_select == 3) {
if(homenews.topic2._currentframe == 10) { //if it's red
homenews.topic2.play();
}
if(homenews.topic3._currentframe == 1) { //if it's black
homenews.topic3.play();
}
if(homenews.topic1._currentframe == 10) { //if it's red
homenews.topic1.play();
}
}
I made an attempt by trying this, but I can't get it to work, or any other form of it.
Code:
for (i=1; i >= 3; i++) {
if(_root.news_select == i) {
if("homenews.topic" + i + "._currentframe" == 1) { //if it's black
"homenews.topic" + i + ".play()"; // make it red
}
} else {
if("homenews.topic" + i + "._currentframe" == 10) { //if it's red
"homenews.topic" + i + ".play()"; // make it black
}
}
}
Please Help!
Thanks,
Rockstar