Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How can I push arrays into another array?

Explorer ,
Mar 20, 2013 Mar 20, 2013

This part works. e is the return(e) from aFunction. The + adds two names together with a new line break \n.

for (var i:uint = 0; i < 50 ; i++)

{

          aFunction();

          newArray = [e, oldArray1[0][0]+oldArray1[0][1]];

oldArray1.shift();

}

So the newArray has [e, "name \n other name"]. Like I said this part works fine.

I want to double the part going in, for example:

for (var i:uint = 0; i < 50 ; i++)

{

  aFunction();

  newArray = [[e, oldArray1[0][0]+oldArray1[0][1]], [e, oldArray1[0][0]+oldArray1[0][1]]];

oldArray1.shift();

}

So it would be [ [e, "name \n other name"], [e, "name \n other name"] ]

But I keep getting errors and general not-working-ness from modifying the first part in any way.

TOPICS
ActionScript
441
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Mar 20, 2013 Mar 20, 2013

Try while loop - there is not enough code to tell what role other code part play. Also you should post the errors you get.

while(oldArray1.length > 0) {

          aFunction();

          newArray.push([[e, oldArray1[0][0] + oldArray1[0][1]], [e, oldArray1[0][0] + oldArray1[0][1]]]);

          oldArray1.shift();

}

Translate
Guru ,
Mar 20, 2013 Mar 20, 2013
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 20, 2013 Mar 20, 2013
LATEST

Try while loop - there is not enough code to tell what role other code part play. Also you should post the errors you get.

while(oldArray1.length > 0) {

          aFunction();

          newArray.push([[e, oldArray1[0][0] + oldArray1[0][1]], [e, oldArray1[0][0] + oldArray1[0][1]]]);

          oldArray1.shift();

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines