3 Replies Latest reply on May 19, 2007 1:08 AM by jwize

    Dynamic Array populating

    jwize
      I need to load the images and then fill up the five arrays dynamically. The part of interest is how to reference the array with the string variable (arrName.. headshots_thumbs, kids_thumbs, maternity_thumb etc...)

      This is the line which I wrote which is supposed to reference the arrays correctly.

      MovieClip(_root[arrName]).push(_mc);
        • 1. Re: Dynamic Array populating
          barryels

          [b[In your OnLoad function try replacing:
          var arrName:String = folder+"_thumbs";

          with this:
          arrName = this[folder+"_thumbs"];

          That should work, and remember to change the variable declaration:
          var arrImages:MovieClip = new Array();
          to:
          var arrImages:Array = new Array();
          • 2. Re: Dynamic Array populating
            barryels Level 1

            [b[In your OnLoad function try replacing:
            var arrName:String = folder+"_thumbs";

            with this:
            var arrName:Array = new Array();
            arrName = this[folder+"_thumbs"];

            That should work, and remember to change the variable declaration:
            var arrImages:MovieClip = new Array();
            to:
            var arrImages:Array = new Array();

            • 3. Re: Dynamic Array populating
              jwize Level 1
              Here is a simplified version. Still, I can't get it to work properly. I had to succumb to a switch case to deal with the populating of files. I would really like to find out if this can be done or not. This would alleviate some much anguish.