2 Replies Latest reply on Feb 14, 2017 6:59 AM by mercedesc43970157

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


      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!

        • 1. Re: How to load the Canvas before the rest of the content of a site?
          Colin Holgate MVP & Adobe Community Professional

          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);


          1 person found this helpful
          • 2. Re: How to load the Canvas before the rest of the content of a site?
            mercedesc43970157 Level 1

            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.