1. #1
    Sencha User
    Join Date
    Sep 2013
    Location
    Switzerland
    Posts
    17
    Vote Rating
    0
    thomahawk is on a distinguished road

      0  

    Default Quick Load first scene without waiting

    Quick Load first scene without waiting


    I specifically made a first scene with a low KB image ( 25KB ) for a quick appearance. Nevertheless, it is still not showing quicker than before. The following scenes contain 2 gif animations with a total of 3 MB. It seems it is still loading all content, before the first scene shows up.

    How can I make the first scene appear, before it loads all the rest?

    (I suppose this has been asked before, but I can not find anything specific enough).

    Thanks
    Thom

  2. #2
    Sencha - Architect Dev Team
    Join Date
    Apr 2012
    Posts
    181
    Vote Rating
    18
    miro.bojic will become famous soon enough miro.bojic will become famous soon enough

      0  

    Default


    Hi,

    You can force preloading of the images with the following JS code:

    Code:
    //1st img
    var img = new Image();
    img.src = "/path/to/your/image";
    //2nd img
    var img2 = new Image();
    img2.src = "/path/to/your/2nd/image";
    //etc
    This code should be executed at the very beginning before the scenes are loaded, so you should place it under Project->Start.

  3. #3
    Sencha User
    Join Date
    Sep 2013
    Location
    Switzerland
    Posts
    17
    Vote Rating
    0
    thomahawk is on a distinguished road

      0  

    Default


    Hi Miro
    I tried this, but it does not make any difference. It still loads everything for all scenes before the first scene starts playing. The result is a long delay of a blank nothingness until anything shows up.

    What I am trying to achieve is: Loading the one image for the first scene. Start playing the first scene and then while the first scene plays, load the images for the other scenes.

    I also tried placing a background image in the page or iframe. This would suffice as a placeholder until the animation is loaded and can start playing. Unfortunately a big white box covers about 1/3 of that image. Thats why I created a small quick loading first scene, which does not help anything if it also only shows up after all scene images are loaded.

    Di you have any other idea?

  4. #4
    Sencha - Architect Dev Team
    Join Date
    Apr 2012
    Posts
    181
    Vote Rating
    18
    miro.bojic will become famous soon enough miro.bojic will become famous soon enough

      0  

    Default


    Hi thomahawk - I've sent you a private message.

  5. #5
    Sencha User
    Join Date
    Sep 2013
    Location
    Switzerland
    Posts
    17
    Vote Rating
    0
    thomahawk is on a distinguished road

      0  

    Default


    As an input to others, here is Miro's solution:

    Because all the scenes are on the same page, all the images are loaded immediately by the browser. The browser also loads all the html structure before executing any JS or animating the page - therefore you were getting a white screen until all the images were loaded.

    What needed to be done is to initialize loading of the two larg gif files after the initial page was loaded. For this, I set the default path for the background images in scenes 3 and 4 to mountain-1.gif (because this is loaded for scene 2 anyway and is relatively small size) and then added the following lines that are executed on start of scene 1:

    controller.getElementById('scene-3-mountain').firstChild.firstChild.src="assets/mountain.gif";
    controller.getElementById('scene-4-mountain').firstChild.firstChild.src="assets/mountain-open.gif";

    This means that mountain.gif and mountain-open.gif will not be loaded initially by the browser, instead, we substitute what the image files point to after the scene 1 has started.

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar