Custom build: Callbacks not firing
unematiii opened this issue · 2 comments
I cant get this library to work :
initControls : function() {
console.log('Map::initControls()');
// Canvas controller
this.stage = new CreateJS.Stage(this.$el[0]);
// Assets
this.queue = new CreateJS.LoadQueue(true);
this.queue.on('complete', function () {
console.log('Complete!');
}, this);
this.queue.on('error', function () {
console.log('Error!');
}, this);
var assets = {
manifest : [{
'id': 'bg1',
'src': '1.png'
},
{
'id': 'bg2',
'src': '2.jpg'
},
{
'id': 'bg3',
'src': '3.png'
}],
path : this.assetPath
};
console.log(JSON.stringify(assets));
this.queue.loadManifest(assets);
return this;
},
this.assetPath
is correct. From the Web inspector I can see only 1 AJAX request (for the first image, completes successfully). No further requests are made. Image paths/names are correct. Neither of complete
and error
are called! Stack trace:
index.js?ver=4.6.1:22778 XHR finished loading: GET "http://localhost/mypath/1.png" (109KB)
p.load @ index.js?ver=4.6.1:22778p.load @ index.js?ver=4.6.1:21929
p.load @ index.js?ver=4.6.1:21929
p.load @ index.js?ver=4.6.1:25240p._loadItem @ index.js?ver=4.6.1:24593
p._loadNext @ index.js?ver=4.6.1:24575p.setPaused @ index.js?ver=4.6.1:24325
p.loadManifest @ index.js?ver=4.6.1:24219
initControls @ index.js?ver=4.6.1:4427
...
Tested on Mac OS Sierra: Latest FF, latest Chrome, latest Safari.
It is possible your assets are getting treated as a sub-manifest (something we are hoping to remove in the next release) - which means paths might not get propagated properly. I have not seen the exact issue you are reporting, but a quick fix would be to substitute the asset path with a simple manifest array:
this.queue = new CreateJS.LoadQueue(true, this.assetPath);
this.queue.loadManifest([...array of items]);
I can take a closer look at your use-case to see if I can reproduce.
Problem solved! The issue was faulty custom build with incorrect exports & global defs.