• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to load the Canvas before the rest of the content of a site?

Community Beginner ,
Feb 01, 2017 Feb 01, 2017

Copy link to clipboard

Copied

I made a little game with Animate CC and I exported as Canvas.

Everything works pretty well, but the game is the last thing that loads when I'm testing online, in the context of my website.

Css styles, images, adsense ads, everything loads before the game.

In fact, it gives the impression that the canvas waits until everything else is loaded to start its own load.

The only clue I have is that it may be this line that is giving that order to the Canvas:

"<body onload="init();"

In that case, it can be changed?

My concern is that the game is the main content of the site, and it is not logical that it is the last thing to load.

Many thanks to those who can guide me towards the solution!

Views

200

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
LEGEND ,
Feb 01, 2017 Feb 01, 2017

Copy link to clipboard

Copied

It could be that it is loading first, but that it takes a while to do so. If you could speed up the loading it may be good enough.

You can make the loading of the game up to 6 times faster, by making this change in the HTML:

var loader = new createjs.LoadQueue(false);

and another line to set the number of connections it can use at the same time:

var loader = new createjs.LoadQueue(false);

loader.setMaxConnections(6);

Votes

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
Community Beginner ,
Feb 14, 2017 Feb 14, 2017

Copy link to clipboard

Copied

LATEST

Thanks Colin,

but I had already included those lines of code and this load problem is still present.

I develop games for very young children, (but they are adults those who choose which page to look at).

I have 80 mini games made in flash and I am migrating from flash to html5 canvas with Animate, the results are very satisfactory, but the rebound in the website for the games on canvas has gone up from 20% to 70%.
It is maddening.
I attribute it to this type of upload, which shows ALL the content of the page before the game, (css, js, small png images, adsense  asynchronous advertisements, some text, one contact form). I would also leave a page that the last thing that shows me is the content I have come to look for.

For example, measuring loading times with the network tab of the Google Developers Console, on a page with a total transfer of 1.1MB, where the game weighs 138KB of javascript and 129 KB of sounds, always, invariably, the last thing to load are the sounds of the game.

It is for all this that I am looking for the way to be able to decide what is loaded first on my site. If anyone has an answer I will be very grateful.

Votes

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