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

Calling the next number in an array through a function?

New Here ,
Jun 20, 2014 Jun 20, 2014

ow do I request the next number in an array?

For example - currently being used for a loop:

for (i=0; i = levelSettings[0]; i++)

But when the function (named - NextLevel() ) is called I would like that loop to call the next number in that array.

Example:

(i=0; i = levelSettings[1]; i++) //Not the change in the levelSettings

I would like this to work for all subsequent numbers in that particular array - so it can continue through to levelSettings[10] and so on.

Cheers!

TOPICS
ActionScript
188
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
Community Expert ,
Jun 20, 2014 Jun 20, 2014

use:

for(var k:Number=0;k<levelSettings.length;k++){

for(var i:Number=0;i<levelSettings;i++){

.

.

}

}

p.s. please mark correct responses.

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
New Here ,
Jun 20, 2014 Jun 20, 2014

I will attempt to apply to use this in my code in just a minute.

Could you explain to me how the code works?

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
Community Expert ,
Jun 20, 2014 Jun 20, 2014
LATEST

in the outter for-loop, k is varying from 0 to the last index in levelSettings.

in the inner for-loop i varies from 0 to levelSettings.

ie,

0 to levelSettings[0]

0 to levelSettings[1]

.

.

.

0 to levelSettings[last_index]

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