thinkpixellab / PxLoader

PxLoader is a simple JavasScript library for creating preloaders and resource downloaders for HTML5 apps.
http://thinkpixellab.com/pxloader
1.11k stars 173 forks source link

Cannot read property 'origin' of undefined #56

Closed gem0303 closed 8 years ago

gem0303 commented 8 years ago

PxLoaderImage.js is causing an error due to these lines of code:

if (options.origin) {
   img.crossOrigin = options.origin;
}

This is how I'm defining the loader:

loader = new PxLoader();
loader.add(new PxLoaderImage('images/arrow-bottom.jpg'));

A user reported this and then closed the topic, saying he solved it by "passing in all the args", but he didn't post his code solution. I don't know what arguments the loader needs. Help?

And since I have the topic open, one more question: when you say PxLoaderSound.js "works with SoundManager 2", does that mean I need to download that API? What order should I load it in (before or after the px files)?

joelfillmore commented 8 years ago

Sorry, the options should be optional. I've checked in a fix for that issue.

Yes, PxLoaderSound requires SoundManager2. We have some documentation which shows how to use this plugin. We should probably include that documentation as part of the repo, I'll try to do that soon.

We also have a recent contribution in PxLoaderAudio, which uses plain HTML5 audio, so you wouldn't need SoundManager2. No documentation on that yet, but the API is really similar to the Image and Video loaders.

Hope this helps!