We help IT Professionals succeed at work.

Loop attachMovie and position movieclips

msukow asked
Last Modified: 2006-11-18
I have the following code:

for (i=1; i<10; i++) {
      this.createEmptyMovieClip("menuMC"+i, i);
// Creates Option 2 MC Button
menuMC1.attachMovie("LeftMenuMC_1", "leftMenuOptionMC_1", 1);
menuMC1._x = 10;
menuMC1._y = 100;
// Creates Option 2 MC Button
menuMC2.attachMovie("LeftMenuMC_2", "leftMenuOptionMC_2", 2);
menuMC2._x = 10;
menuMC2._y = 125;
// Creates Option 3 MC Button
menuMC3.attachMovie("LeftMenuMC_3", "leftMenuOptionMC_3", 3);
menuMC3._x = 10;
menuMC3._y = 150;
// Creates Option 4 MC Button
menuMC4.attachMovie("LeftMenuMC_4", "leftMenuOptionMC_4", 4);
menuMC4._x = 10;
menuMC4._y = 175;

I want to be able to loop through the number of MCs needed, attach them, then position them. I have tried using EVAL, but not sure what the format would be. The MCs are created and in the library with names like LeftMenuMC_1, LeftMenuMC_2, etc.

Thanks up front!
Watch Question

This one is on us!
(Get your first solution completely free - no credit card required)
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.