I'm encountering an issue while attempting to construct a class for loading images. The error message states that name "Image" not found
within the array definition, even though I create an image object later in the code.
class ImageLoader {
static toLoadCount:number = 0;
private static images = Array<Image>();
static onAllLoaded() {};
static onImageLoad() {
--Images.toLoadCount;
if(Images.toLoadCount == 0)
Images.onAllLoaded();
}
static load(path: string) {
++Images.toLoadCount;
let img = new Image();
img.src = "Images/" + path;
img.onload = Images.onImageLoad;
Images.images[path.substring(0, path.length - 4)] = img;
return img;
}
static allImagesLoaded() {
return (Images.toLoadCount == 0);
}
[key: string]: any;
}