I have a library of sorts with 6 pictures (called select 1-6) per page contained in its own movieclip.
For the first page I have
Code:
select1.gotoAndStop(1);
select2.gotoAndStop(2);
select3.gotoAndStop(3);
select4.gotoAndStop(4);
select5.gotoAndStop(5);
select6.gotoAndStop(6);
button1.onPress = function () {
_root.head.eyes.gotoAndStop(1)
};
button2.onPress = function () {
_root.head.eyes.gotoAndStop(2)
};
button3.onPress = function () {
_root.head.eyes.gotoAndStop(3)
};
button4.onPress = function () {
_root.head.eyes.gotoAndStop(4)
};
button5.onPress = function () {
_root.head.eyes.gotoAndStop(5)
};
button6.onPress = function () {
_root.head.eyes.gotoAndStop(6)
};
For the 2nd page I have:
Code:
select1.gotoAndStop(7);
select2.gotoAndStop(8);
select3.gotoAndStop(9);
select4.gotoAndStop(10);
select5.gotoAndStop(11);
select6.gotoAndStop(12);
button1.onPress = function () {
_root.head.eyes.gotoAndStop(7)
};
button2.onPress = function () {
_root.head.eyes.gotoAndStop(8)
};
button3.onPress = function () {
_root.head.eyes.gotoAndStop(9)
};
button4.onPress = function () {
_root.head.eyes.gotoAndStop(10)
};
button5.onPress = function () {
_root.head.eyes.gotoAndStop(11)
};
button6.onPress = function () {
_root.head.eyes.gotoAndStop(12)
};
...which works, but it seems rather long winded to have to change the numbers each time when all they'll be doing is going up by 6 on each page.
I was thinking something along the lines of this would be better (don't laugh...)
Code:
select1.gotoAndStop(i);
select2.gotoAndStop(i+);
select3.gotoAndStop(i+2);
select4.gotoAndStop(i+3);
select5.gotoAndStop(i+4);
select6.gotoAndStop(i+5);
button1.onPress = function () {
_root.head.eyes.gotoAndStop(i)
};
button2.onPress = function () {
_root.head.eyes.gotoAndStop(i+)
};
button3.onPress = function () {
_root.head.eyes.gotoAndStop(i+2)
};
button4.onPress = function () {
_root.head.eyes.gotoAndStop(i+3)
};
button5.onPress = function () {
_root.head.eyes.gotoAndStop(i+4)
};
button6.onPress = function () {
_root.head.eyes.gotoAndStop(i+5)
};
var i:Number = 1;
Then for each page I could just change 'i' to 6, 12, 18, 24 and so on.
As I have a lot of pages to do this could really be a time saver. Does anyone know how to get this code working? I'm hoping I'm not too far off, just missing some inverted commas here and a bracket there.
Any help would be much appreciated. I've been scouring the net but its quite a specific problem and I must not be using the right key words in my searches.
Thanks!
Fran