How to load bitmaps in an array with AS2?

982 Views Asked by At

I would know if with AS2 it's possible to load programmatically a bulk of images and save them in an array; then how to attach programmatically each image to an empty movieclip.

I know how to do this in AS3 however it seems impossible in AS2.

Thank You in advance,

Max

2

There are 2 best solutions below

0
jpea On BEST ANSWER

Not tested, but here's the gist:

var bitmaps:Array = [];
var tempClip = this.createEmptyMovieClip()
var timer;

function loadImage(){
   timer = setInterval(checkHeight, 10)
   var mc = tempClip.createEmptyMovieClip("img",this.getNextHighestDepth());
   mc.loadMovie(myPathToMyImage)
}

function checkHeight(){
   if (tempClip._height){
       clearInterval(timer)
      var bmp:BitmapData = new BitmapData(tempClip._width, tempClip._height, true);
       bmp.draw(tempClip);
       bitmaps.push(bmp);
       tempClip.unloadMovie();
   }
}
0
robertp On

I believe it should be quite the same as in AS3. Load the image, generate a BitmapData object and store it in an Array.

Rob