Hello all - Flash 8 AS2 problem here…
I’m a bit green when it comes to code and I have a specific thing I need to do which has had me going round in circles (no laughing at the back!). It must be pretty simple but I’m stumped!
Basically I have 6 movieclips on the timeline with instance names ‘btn1’, ‘btn2’ etc to ‘btn6’. These movieclips have an “on” and an “off” state (frame labels)
I make an array:
ActionScript Code:
[LEFT][COLOR=#993300]var[/COLOR] buttons = [COLOR=#000000][[/COLOR]btn1, btn2, btn3, btn4, btn5, btn6[COLOR=#000000]][/COLOR];
[/LEFT]
When each mc is clicked, it should switch ‘on’ or ‘off’ alternately. So far so good, here is my code that’s working:
ActionScript Code:
[LEFT][COLOR=#f000f0]//[/COLOR]
[COLOR=#993300]for[/COLOR] [COLOR=#000000]([/COLOR]item [COLOR=#993300]in[/COLOR] buttons[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
buttons[COLOR=#000000][[/COLOR]item[COLOR=#000000]][/COLOR].[COLOR=#000000]state[/COLOR] = [COLOR=#993300]false[/COLOR];
buttons[COLOR=#000000][[/COLOR]item[COLOR=#000000]][/COLOR].[COLOR=#993300]onRelease[/COLOR] = [COLOR=#993300]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#993300]if[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#993300]this[/COLOR].[COLOR=#000000]state[/COLOR] == [COLOR=#993300]false[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#993300]this[/COLOR].[COLOR=#993300]gotoAndStop[/COLOR] COLOR=#000000[/COLOR];
[COLOR=#993300]this[/COLOR].[COLOR=#000000]state[/COLOR] = [COLOR=#993300]true[/COLOR];
[COLOR=#000000]}[/COLOR] [COLOR=#993300]else[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#993300]this[/COLOR].[COLOR=#993300]gotoAndStop[/COLOR] COLOR=#000000[/COLOR];
[COLOR=#993300]this[/COLOR].[COLOR=#000000]state[/COLOR] = [COLOR=#993300]false[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]
[/LEFT]
HOWEVER! When btn1 is clicked, not only do I need to turn it on/off, but I need it disable/enable btn4 at the same time (so when btn1 is ‘off’ btn4 is enabled, but when btn1 is ‘on’ btn4 is disabled).
This goes for btn2 & btn3 also so:
btn1 enables/disables btn4
btn2 enables/disables btn5
btn3 enables/disables btn6
This shouldn’t work the other way round - so btn4,btn5 and btn6 should just switch on and off without affecting anything else.
Is there a neat way of doing this, or should I just split things up so that btn1 & btn4 are in one array, btn2 & btn5 in another, and btn3 & btn6 in another?
Please help if you can!
All the best,
Chris