How to import JSON animation file into Cocos Creator using Typescript?

by Philip Chow   Last Updated June 25, 2019 09:13 AM - source

I'm in the process of making a game and I want to import json animation file from remote resource into the game using Typescript, currently using Xampp as the localhost. There is no problem for me to import those file from assets using the function in Cocos Creator, but I wish to import it from remote resource.

The original code can import purely PNG image into the game very well, however when I want to import json animation file, the code can't read the file at all. My json animation file contain a PNG image, a json file, a text document with .atlas at the end of file naming. What is the correct syntax or coding to import it?

/**
* Setup mainboard background and foreground sprite from remote resources
*/
setRemoteImageToMainboardSprites () {
   if (this.mainBoardBackgroundSprite) {
 RemoteResourceManager.getInstance().setRemoteImageToSprite(this.mainBoardBackgroundSprite,'mainboard_background');
}
if (this.mainBoardForegroundSprite) {
  RemoteResourceManager.getInstance().setRemoteImageToSprite(this.mainBoardForegroundSprite,'mainboard_foreground');
}

}



Related Questions


How to create effect lines?

Updated July 10, 2019 12:13 PM

Unity Tiny Project TypeScript issue in Rider IDE

Updated January 04, 2019 09:13 AM

Parallax background in with depth in Phaser 3

Updated December 04, 2018 21:13 PM

calling function with callback inside update

Updated August 24, 2019 04:13 AM