2 Replies Latest reply on Jul 14, 2009 9:47 AM by kglad

    Cant get loadmovie to display image

    chieffan

      I have this for loop where I am circling through an array.  I have swf's for each of the numbers like dropTarget_1.swf, etc.  For whatever reason I can't seen to get this loaded into my holder.

       

      When I hard code it then it works. Any advice?

       

      for (n=1; n<=myDropDetails.length; n++) {
        rand = nums.splice(random(nums.length), 1)[0];
        trace(rand);
       
        this.createEmptyMovieClip("holder",n);
        this["dropTarget"+rand+".swf"],holder)
        loadMovie("dropTarget_"+rand+".swf", holder);
      holder._x=holder._x+30
        //holder.loadMovie("dropTarget_1.swf");
      }

        • 1. Re: Cant get loadmovie to display image
          Ned Murphy Adobe Community Professional & MVP

          There are too many things confused in your code to be sure what you are trying to tell it to do at times.  Here is a revised coding that may be what you are after.  Even if it isn't, it may be a better place to start to resolve things from.

           

          function shuffle(a:Array):Array {
          var len:Number = a.length-1;
          for (var ivar:Number = len; ivar>=0; ivar--) {
            var p:Number = Math.floor(Math.random()*(ivar+1));
            var t = a[ivar];
            a[ivar] = a[p];
            a[p] = t;
          }
          return a;
          }

           

          var nums = new Array(1,2,3);
          var xLoc = 0;

           

          nums = shuffle(nums); // randomize the nums array

           

          for (n=0; n<=nums.length-1; n++) {
                this.createEmptyMovieClip("holder"+n,this.getNextHighestDepth());
                loadMovie("dropTarget_"+nums[n]+".swf", this["holder"+n]);
                this["holder"+n]._x = xLoc;
                xLoc += 30;
          }

          • 2. Re: Cant get loadmovie to display image
            kglad Adobe Community Professional & MVP

             

            for (n=1; n<=myDropDetails.length; n++) {
              rand = nums.splice(random(nums.length), 1)[0];
              trace(rand);  // <-- is that tracing what you want?
             
              this.createEmptyMovieClip("holder",n);
              this["dropTarget"+rand+".swf"],holder)  // this line shouldn't even compile.  what's it supposed to do?
              loadMovie("dropTarget_"+rand+".swf", holder);
            holder._x=holder._x+30
              //holder.loadMovie("dropTarget_1.swf");
            }