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

Access movieclips from movieclip with a loop?

New Here ,
May 30, 2013 May 30, 2013

There is a moviclip under instance name of 'stadium', inside it I have 4 'log' moviclips - 'log0', 'log1',...'log3';

The thing is, that I don't know how to have access with each of them withing just one loop. Like, if I had 1000 logs inside, it's stupid to write code by hand for each of them.

My Code:

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

{

     var x:int = stadium.this["log" + i].x;

     ...

}

so of course, this gives me an error, because the way it's written is incorrect.

What is a solution for that? Thanks...

TOPICS
ActionScript
427
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

Community Expert , May 30, 2013 May 30, 2013

use:

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

{

     var xvar:int = stadium["log" + i].x;

     ...

}


Translate
Community Expert ,
May 30, 2013 May 30, 2013

use:

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

{

     var xvar:int = stadium["log" + i].x;

     ...

}


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 ,
May 30, 2013 May 30, 2013

Thanks kglad for quick response

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 ,
May 30, 2013 May 30, 2013
LATEST

you're welcome.

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