Reputation: 811
I'm trying to use PreloadJS to load an image. I took the getting started code from http://www.createjs.com/getting-started so,
function loadImage() {
var preload = new createjs.LoadQueue();
preload.addEventListener("fileload", handleFileComplete);
preload.loadFile("assets/preloadjs-bg-center.png");
}
function handleFileComplete(event) {
document.body.appendChild(event.result);
}
Which works great, but changing the URL to a custom one doesn't play so nice:
preload.loadFile("http://localhost:3000/URLthatReturnsAnImageWithoutFileType");
I'm unable to render the image. I'm guessing the loadFile
function parses the file type in the provided URL string. Is there a way to tell PreloadJS the provided asset is indeed an image and render it?
Upvotes: 1
Views: 618
Reputation: 1143
According to LoadQueue's documentation, the file type of an item is determined by it's file extension. If it doesn't have an extension, then you can pass in a type property:
preload.loadFile({src:"hello", type:createjs.AbstractLoader.IMAGE});
Upvotes: 2