A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Replacing multiple statements with a loop - Syntax incorrect?

  1. #1
    Member
    Join Date
    Jan 2001
    Posts
    54

    Unhappy Replacing multiple statements with a loop - Syntax incorrect?

    I have a series of images loaded in via XML and assigned to "loady" movieclips. This code works fine:

    Code:
    _root.myMCL.loadClip(_root.myImages[0].attributes.url,_root.loady0);	
    _root.myMCL.loadClip(_root.myImages[1].attributes.url,_root.loady1);	
    _root.myMCL.loadClip(_root.myImages[2].attributes.url,_root.loady2);	
    _root.myMCL.loadClip(_root.myImages[3].attributes.url,_root.loady3);	
    _root.myMCL.loadClip(_root.myImages[4].attributes.url,_root.loady4);	
    _root.myMCL.loadClip(_root.myImages[5].attributes.url,_root.loady5);
    I want to replace this with a loop since I know the total amount of items (myImagesNo), but this isn't working:

    Code:
    for (i=0; i<_root.myImagesNo; i++) {	
    _root.myMCL.loadClip(_root.myImages[i].attributes.url,this["_root.loady" + i]);
    }
    Am I doing something completely boneheaded?

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    this["_root.loady" + i]

    replace with:
    _root["loady" + i]

    gparis

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center