3 Replies Latest reply on Feb 23, 2011 6:44 AM by kglad

    Importing Images Dynamically to movieclip

    kad_911

      Hello, I made this flash CS3 project using Actionscript 2.0

       

      I want to import some images in a folder to stage. The images are named 1.jpg, 2.jpg, 3.jpg etc.. All these images are 600px in width.

       

      I used a movieclip as a container for these images.

       

      Here's the code.
      for(i=0; i<3; i++){
      img_scroll.attachMovie("imgbar", "img"+i, _root.getNextHighestDepth());
      img_scroll["img"+i]._x = i * 600;
      img_scroll["img"+i]._y = 0;
      loadMovie(i+1 +".jpg", img_scroll["img"+i]);
      }

       

      img_scroll is the movieclip that should contain the images. and imgbar is an empty movieclip.

       


      When i run this code, only the last image is loaded. since i used i<3 in the for loop, only the 3rd image is loaded. its in the right place. (_x = 1800). The first and second images are not loaded...

       

      Any1 can help please?

       

       

      PS: If i use _root.attachMovie, and _root instead of img_scroll everywhere, all the images are loaded perfectly and in place. But i want them to be inside the img_scroll movieclip. Because that will be animating.