Hi,
I know there are similar questions here that have been answered, but after trying to make sense of it, I still can’t get this to work.
Based on an array, I attach a number of MovieClips from the Library. On release they go to a certain frame, representing the “pressed” state of the button. The problem is, that I can’t figure out how to reset the last pressed button back to it’s original state…
Here is the Actionscript code I have so far:
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#0000FF]stop[/COLOR]COLOR=#000000[/COLOR];
daCap.[COLOR=#0000FF]play[/COLOR]COLOR=#000000[/COLOR];
scrollUp.[COLOR=#0000FF]_visible[/COLOR] = [COLOR=#000000]false[/COLOR];
scrollDown.[COLOR=#0000FF]_visible[/COLOR] = [COLOR=#000000]false[/COLOR];
bar.[COLOR=#0000FF]_visible[/COLOR] = [COLOR=#000000]false[/COLOR];
[COLOR=#808080]//----------------------[/COLOR]
[COLOR=#0000FF]this[/COLOR].[COLOR=#000080]container[/COLOR].[COLOR=#0000FF]setMask[/COLOR]COLOR=#000000[/COLOR];
aStyle = [COLOR=#000000]new[/COLOR] [COLOR=#0000FF]TextField[/COLOR].[COLOR=#000080]StyleSheet[/COLOR]COLOR=#000000[/COLOR];
aStyle.[COLOR=#0000FF]load[/COLOR]COLOR=#000000[/COLOR];
container.[COLOR=#000080]TextClip[/COLOR].[COLOR=#000080]myText[/COLOR].[COLOR=#0000FF]html[/COLOR] = [COLOR=#000000]true[/COLOR];
container.[COLOR=#000080]TextClip[/COLOR].[COLOR=#000080]myText[/COLOR].[COLOR=#0000FF]wordWrap[/COLOR] = [COLOR=#000000]true[/COLOR];
container.[COLOR=#000080]TextClip[/COLOR].[COLOR=#000080]myText[/COLOR].[COLOR=#0000FF]multiline[/COLOR] = [COLOR=#000000]true[/COLOR];
container.[COLOR=#000080]TextClip[/COLOR].[COLOR=#000080]myText[/COLOR].[COLOR=#000080]label[/COLOR].[COLOR=#0000FF]condenseWhite[/COLOR] = [COLOR=#000000]true[/COLOR];
[COLOR=#0000FF]for[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#000000]var[/COLOR] i = [COLOR=#000080]0[/COLOR]; i<promoArray.[COLOR=#0000FF]length[/COLOR]; i++[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]var[/COLOR] item = [COLOR=#0000FF]this[/COLOR].[COLOR=#000080]container[/COLOR].[COLOR=#0000FF]attachMovie[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]“clip”[/COLOR], [COLOR=#FF0000]“clip”[/COLOR]+i, i[COLOR=#000000])[/COLOR];
[COLOR=#0000FF]if[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
scrollUp.[COLOR=#0000FF]_visible[/COLOR] = [COLOR=#000000]true[/COLOR];
scrollDown.[COLOR=#0000FF]_visible[/COLOR] = [COLOR=#000000]true[/COLOR];
bar.[COLOR=#0000FF]_visible[/COLOR] = [COLOR=#000000]true[/COLOR];
item.[COLOR=#0000FF]_y[/COLOR] = COLOR=#000000[/COLOR];
item.[COLOR=#000080]id[/COLOR] = i;
getXML[COLOR=#000000]([/COLOR]item, i[COLOR=#000000])[/COLOR];
item.[COLOR=#000080]myTarget[/COLOR].[COLOR=#0000FF]loadMovie[/COLOR]COLOR=#000000[/COLOR];
item.[COLOR=#000080]iconTarget[/COLOR].[COLOR=#0000FF]loadMovie[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#808080]//----HOW WOULD I SET THE OTHER BUTTONS TO GO AND STOP AT FRAME 20 (which is the “off” state) ? -------------[/COLOR]
item.[COLOR=#0000FF]onRelease[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]trace[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#0000FF]if[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]_currentframe[/COLOR] == [COLOR=#000080]20[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]gotoAndStop[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR] [COLOR=#0000FF]else[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]if[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]_currentframe[/COLOR] == [COLOR=#000080]21[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]gotoAndStop[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#808080]//----------------------[/COLOR]
[COLOR=#000000]function[/COLOR] getXML[COLOR=#000000]([/COLOR]clip, d[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
clip.[COLOR=#000080]aContent[/COLOR] = [COLOR=#000000]new[/COLOR] [COLOR=#0000FF]XML[/COLOR]COLOR=#000000[/COLOR];
clip.[COLOR=#000080]aContent[/COLOR].[COLOR=#0000FF]ignoreWhite[/COLOR] = [COLOR=#000000]true[/COLOR];
clip.[COLOR=#000080]aContent[/COLOR].[COLOR=#0000FF]load[/COLOR]COLOR=#000000[/COLOR];
clip.[COLOR=#000080]aContent[/COLOR].[COLOR=#0000FF]onLoad[/COLOR] = [COLOR=#000000]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]if[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]
clip.[COLOR=#000080]TextClip[/COLOR].[COLOR=#000080]myText[/COLOR].[COLOR=#000080]styleSheet[/COLOR] = aStyle;
clip.[COLOR=#000080]TextClip[/COLOR].[COLOR=#000080]myText[/COLOR].[COLOR=#0000FF]text[/COLOR] = clip.[COLOR=#000080]aContent[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR];
[COLOR=#000000]}[/COLOR]
[/LEFT]
[/FONT]
Do I have to use a for…in loop?
Thanks for any help,
Rufus