carmenMiranda
Programmer
I have a movie with three navigation tabs. These tabs all have the same behaviours. The code I have written works perfectly well, but it just isn't very elegant. There must be a better way than the way I have done it.
Can anyone help me by showing me a more efficient way to code this? :-
Can anyone help me by showing me a more efficient way to code this? :-
Code:
//-----------define all button actions-----------------
tab01.onRollOver = function() {
moveTab(tab01, moveSpeed);
};
tab01.onRollOut = function() {
returnTab(tab01, moveSpeed);
};
tab01.onPress = function() {
colourTab01.setTint(255, 0, 0, clickShade);
};
tab01.onRelease = function() {
colourTab01.setTint(0, 0, 0, 0);
gotoAndStop("tab01");
interaction(1);
};
tab02.onRollOver = function() {
moveTab(tab02, moveSpeed);
};
tab02.onRollOut = function() {
returnTab(tab02, moveSpeed);
};
tab02.onPress = function() {
colourTab02.setTint(255, 0, 0, clickShade);
};
tab02.onRelease = function() {
colourTab02.setTint(0, 0, 0, 0);
gotoAndStop("tab02");
interaction(2);
};
tab03.onRollOver = function() {
moveTab(tab03, moveSpeed);
};
tab03.onRollOut = function() {
returnTab(tab03, moveSpeed);
};
tab03.onPress = function() {
colourTab03.setTint(255, 0, 0, clickShade);
};
tab03.onRelease = function() {
colourTab03.setTint(0, 0, 0, 0);
gotoAndStop("tab03");
interaction(3);
};
//-----------------end button actions---------------------