0

I'm trying to load animations from Adobe Animate and it works fine when loading from a web server. But when loading from a local folder, I get "Access denied". The offending line is

loader.loadFile({ src: "images/1170_atlas_.json", type: "spritesheet", id: "1170_atlas_" }, true);

I should be able to simply include the contents of the file in a variable on the page and load the data directly. But I'm having problems finding the createjs function I need to call to load the spritesheet.

Any ideas on how to do this?

tech2017
  • 1,776
  • 1
  • 12
  • 15
Jay Buckman
  • 465
  • 3
  • 12

1 Answers1

0

You can not load JSON locally without doing some things like forcing Chrome to allow file access.

You can also get around it using JSONP, which loads the content as JavaScript.

If you want to manually load the contents, and embed your JSON in your page, you just have to make a new SpriteSheet manually. The EaselJS SpriteSheet docs have examples of this.

Cheers.

Lanny
  • 10,744
  • 1
  • 20
  • 30
  • Thanks. That got me part of the way there. I replaced the loadFile() call with a new createjs.SpriteSheet() call. But then I had to manually call the handleComplete() handler to finish loading the animation. – Jay Buckman Jun 05 '17 at 16:17
  • Yes, there is no asynchronous loading without PreloadJS -- so you just need to run whatever you were doing on complete when there was preloading. Note that you might still want to do some preloading of the images in the SpriteSheet (which is what the SpriteSheetLoader does for you) – Lanny Jun 06 '17 at 03:09
  • I'm just trying to programmatically embed Animate output into other HTML pages. Things work with very little editing (like when I put two animations on the same page, patching up folder names, etc.) but the .json caused me grief when the pages are run from a local drive or DVD. – Jay Buckman Jun 07 '17 at 11:12