Hi, I’ve got some Actionscript that I’m hoping someone can help me neaten up. I’ve got three sets of nine MCs which are animated on rollover or rollout. Each set animates together. I’m sure there’s a much more efficient way of doing what I’m doing with the following code:
tag0.onRollOver = function() {
spinF(tag0, let0, txt0);
};
tag0.onRollOut = function() {
spinF(tag0, let0, txt0);
};
tag1.onRollOver = function() {
spinF(tag1, let1, txt1);
};
tag1.onRollOut = function() {
spinF(tag1, let1, txt1);
};
tag2.onRollOver = function() {
spinF(tag2, let2, txt2);
};
tag2.onRollOut = function() {
spinF(tag2, let2, txt2);
};
tag3.onRollOver = function() {
spinF(tag3, let3, txt3);
};
tag3.onRollOut = function() {
spinF(tag3, let3, txt3);
};
tag4.onRollOver = function() {
spinF(tag4, let4, txt4);
};
tag4.onRollOut = function() {
spinF(tag4, let4, txt4);
};
tag5.onRollOver = function() {
spinF(tag5, let5, txt5);
};
tag5.onRollOut = function() {
spinF(tag5, let5, txt5);
};
tag6.onRollOver = function() {
spinF(tag6, let6, txt6);
};
tag6.onRollOut = function() {
spinF(tag6, let6, txt6);
};
tag7.onRollOver = function() {
spinF(tag7, let7, txt7);
};
tag7.onRollOut = function() {
spinF(tag7, let7. txt7);
};
tag8.onRollOver = function() {
spinF(tag8, let8, txt8);
};
tag8.onRollOut = function() {
spinF(tag8, let8, txt8);
};
function spinF(tagNo, letNo, txtNo) {
if (letNo.back == false) {
tagNo.gotoAndPlay(2);
letNo.gotoAndPlay(2);
txtNo.gotoAndPlay(2);
} else {
tagNo.gotoAndPlay(10);
letNo.gotoAndPlay(10);
txtNo.gotoAndPlay(10);
}
}
Can anyone make this neater with an Array or such like?