shvalb Posted January 6, 2016 Share Posted January 6, 2016 Hi, I'm brand new to Phaser and I saw that you can use the Phaser.Loader in 2 ways: 1. via the 'game' object as follow:game.load.pack(...);game.load.onLoadStart.add(loadStart, this);Which works great! 2. by allocating Loader object as follow:preloader = new Phaser.Loader(game);preloader.pack(...);preloader.onLoadStart.add(loadStart, this);Doesn't work this way! What am I missing in the 2nd option that prevents this code from working? Thank you :-) Link to comment Share on other sites More sharing options...
drhayes Posted January 6, 2016 Share Posted January 6, 2016 What does "doesn't work" mean? What are you trying to do by instantiating your own Loader? Link to comment Share on other sites More sharing options...
shvalb Posted January 6, 2016 Author Share Posted January 6, 2016 When Loader is instantiated this way, it doesn't call the Callback methods. I was trying to allocate a Loader so I can pass it as individual object into different Classes via CTOR. Just something I got used to do when working with other frameworks. But, no matter the reason it should work - else, why it has a CTOR that gets 'game' as a parameter?!? Link to comment Share on other sites More sharing options...
drhayes Posted January 6, 2016 Share Posted January 6, 2016 Did you "start" the loader, i.e. "preloader.start();"? Why not pass the game's loader? Is this to load assets after the initial preload or something? Link to comment Share on other sites More sharing options...
Recommended Posts