0

I have created a class that loads a Tiled Map file and esports it as a createjs Container which contains a lot of bitmaps. It works, but i'd like to cache the map once it is loaded.

Map is shown pretty well, but when I call I call that.sprite.cache() it trows

Uncaught Error: InvalidStateError: DOM Exception 11 easeljs-min.js:63 
b.draw easeljs-min.js:63 b.draw easeljs-min.js:74 
b.draw easeljs-min.js:75 b.update easeljs-min.js:84 
(anonymous function) Main.js:43 
b.dispatchEvent easeljs-min.js:14 
c._tick easeljs-min.js:20 c._handleTimeout

https://gist.github.com/anonymous/5924127

How can I solve it? I read that error is thrown when images are not loaded, but even if I call it after 10 seconds it throws error! :/

  • from the first look, it looks like the SpriteSheet isn't finished loading the asset `resource/TileA2.png` but you are trying to get its' contents, try to add a preloader and see if that works, as a very quick test you can execute everything from line 33 after a ~2second timeout, if that works, then you should use a preloader. – olsn Jul 04 '13 at 13:20
  • Nope, I had alredy tried it before, but the error comes out anyway... Here it is a demo and my full project code: [Code](https://github.com/ilmattodel93/NodeMMORPG/blob/master/lib/Client/TiledMapBuilder.js) [Demo](http://ilmattodel93.github.io/NodeMMORPG/) (obviously use console to debug.) – Mattia Manzo Manzati Jul 04 '13 at 16:23
  • 1
    hm in your Demo you try to invoke the cache() with no parameter, in the Code on gist you made this correctly, I'm guessing your demo link is just not up to date, but you have tried the gist-code already right? – olsn Jul 05 '13 at 10:07

0 Answers0