Preloading error with canvas project on first load with a large spritesheet file

Explorer ,
Dec 05, 2019 Dec 05, 2019

Copy link to clipboard

Copied

I made a canvas project with Animate 2020 (createjs 1.0.0), put it on my server, and I get an error during loading, so the project does not start.
This happens each time on the first load, when I refresh the page, with a second load everything works fine withour errors.
The project uses a large atlas file for the images (9MB). When I'm not using a spritesheet (so all image assets exported in individual files) I don't have the error, but then of course the loading takes much much longer.

 

Any idea what I can do to resolve this?

 

This is the error I'm getting:

Uncaught TypeError: Cannot read property 'getContext' of undefined
at a.b._parseData (createjs.min.js:12)
at new a (createjs.min.js:12)
at handleComplete ((index):51)
at (index):36
at a.b._dispatchEvent (createjs.min.js:12)
at a.b._dispatchEvent (createjs.min.js:12)
at a.b.dispatchEvent (createjs.min.js:12)
at a.b._sendComplete (createjs.min.js:16)
at a.b._loadNext (createjs.min.js:17)
at a.b._processFinishedLoad (createjs.min.js:17)

TOPICS
Error

Views

1.0K

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Dec 10, 2019 Dec 10, 2019
Default timeout for loading individual assets is 8 seconds.   https://createjs.com/docs/preloadjs/classes/LoadItem.html#property_loadTimeout   If one or more of your assets is taking longer than 8 seconds to load, that's probably what's causing the page to fail. Also your page is loading too much and is going to be a bad user experience.   There appears to be no official way to specify a longer timeout, so to extend the timeout period you'll have to manually hack up your generated code. The simp...

Likes

translate

Translate

Translate
Explorer ,
Dec 06, 2019 Dec 06, 2019

Copy link to clipboard

Copied

The problem is simple to reproduce when working with large PNGs. 

Example: make a canvas project 800x600. Put 2 large PNGs on the scene (for example 1000x1000) and publish with using a spritesheet.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 10, 2019 Dec 10, 2019

Copy link to clipboard

Copied

I swithched back to CC2019 but the problem was already there too. It's a frustrating that a simple thing like this does not work

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Dec 10, 2019 Dec 10, 2019

Copy link to clipboard

Copied

Default timeout for loading individual assets is 8 seconds.

 

https://createjs.com/docs/preloadjs/classes/LoadItem.html#property_loadTimeout

 

If one or more of your assets is taking longer than 8 seconds to load, that's probably what's causing the page to fail. Also your page is loading too much and is going to be a bad user experience.

 

There appears to be no official way to specify a longer timeout, so to extend the timeout period you'll have to manually hack up your generated code. The simplest way appears to be to increase the default timeout. In the libs/createjs file, search for LOAD_TIMEOUT_DEFAULT=8e3. The "8e3" is 8000 written using engineering notation. The 8000 is milliseconds, or 8 seconds. Change the 3 to 4. This gives you an 80-second timeout per asset. The createjs file is overwritten every time you publish, so keep a backup copy of the modified version.

 

This is not guaranteed to work, it's just a suggestion.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 11, 2019 Dec 11, 2019

Copy link to clipboard

Copied

Thank you so much! Changing that timeout value does solve my problem!

(oh how I miss the Flash preloaders 😉 )

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines