Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested arrays

Status
Not open for further replies.

vulvair

Technical User
Oct 30, 2002
10
GB
I have this code on frame 1

clip = [middle, bottom, menu, menuarrow, menutext,];

colour = [];
function newcolor(clip, colour) {
MCColor = new Color(clip);
MCColor.setRGB(colour);
}

And this on a button

on (release) {
colour =['0xCCA68C', '0x663300', '0x996633', '0x996633','0xCCA68C'];
for (i=0, j=0; i<9, j<9; i++, j++) {
newcolor(clip, colour[j]);
}
}

What this does is sets each clip to a colour (this works).

I also have a 'texts' array
texts = [tc1, tc2, audio1, js1, js2];

I would like to add an array element to the 'clips' array that would represent all the elements in 'texts'.
I would like to add one colour to the 'colours' array, so that all the elements of 'texts' would be changed to that one colour.

How can I do this? (although it can't be seen here, I do need i AND j in the loop)


 
Soory the loop statement should be
for (i=0, j=0; i<9, j<9; i++, j++) {
newcolor(clip, colour[j]);
}

and not

for (i=0, j=0; i<9, j<9; i++, j++) {
newcolor(clip, colour[j]);
}
 
Hadn't realised it was converting some of the code to italic, the loop statement should be
for (i=0, j=0; i<9, j<9; i++, j++) {
newcolor(clip [ i ], colour[j]);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top