I'm trying to create an image loading class but in the array definition it throws an error saying name "Image" not found, despite creating 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;
}