Andrey Andreev Andrey Andreev - 2 months ago 11
TypeScript Question

Using AssetsLoader in Pixi.js with typescript

It seems that in latest definitions of pixi (like https://github.com/photonstorm/phaser/blob/master/typescript/pixi.d.ts) there is no more property onComplete in AssetLoader. So how should I use AssetLoader now? Please, provide examples, if possible.

Answer

Just add a listener on your AssetLoader for the "onComplete" event. Something like this (assuming your Assetloader is instantiated into this._assetsLoader):

var allAssetsLoadedCallback = () => this.allAssetsLoaded();
this._assetsLoader.addEventListener("onComplete", allAssetsLoadedCallback);
Comments