0 Favourites

Construct 2 scrolling down when not supposed to!

  • Hi everyone,

    I've recently found an issue that's driving me nuts.

    The problem is i want to embed a construct 2 game on a website but i only want to show it when i scroll past some inicial pictures.

    Unfortunately when construct 2 loads, it scrolls down the webpage to its position, even though i'm using iframes.

    How can i fix this?

    I want to prevent Construct from scrolling down the page where the game is embedded!

    Thank you all, <img src="smileys/smiley2.gif" border="0" align="middle" />

    -ViLa

  • Construct 2 games don't try to scroll the page. Are you sure it's not your own page doing it?

  • Hi Ashley,

    I've tried loading a basic HTML page and an SWF file and both work as intended (they load up even outside the visible window).

    But whenever i try to load the Construct 2 index file or another HTML page with it inside, it jumps the current page down to where it loads.

    I'm using something like this:

    <iframe style="padding: 0; margin: 0; border: 0;" src="http://www.url.com/index.html" height="1143" width="100%" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>

    I've also tried doing that with div tags before the iframe ones but the final behaviour is the same.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Could it be anything in the index.html that pulls the focus somehow ?

    Ho, and by the way, last time I used C2 inside a webpage, I prefered to use directly the canvas and start the runtime with onload :

    <div id="c2canvasdiv" width="990" height="207">
       <canvas id="c2canvas" width="990" height="207">
          <div id="c2canvas_off"></div>
       </canvas>
    </div>
    <script type="text/javascript"> 
       jQuery(document).ready(function () {
          cr_createRuntime("c2canvas");
       });
    </script>

    If it is the index that pulls the focus somehow, this would solve the problem.

  • AHA! Found the troublemaker! <img src="smileys/smiley17.gif" border="0" align="middle" />

    Since you didn't expect construct 2 to have that behavior, i understood it had to be something in the code.

    Then i remembered i had a "set text box to focused" on start of layout - which was scrolling down the browser window.

    Removing that part fixed the issue!

    Even though you didn't provide the answer, through your post i managed to find the problem!

    Thank you Ashley!

  • Could it be anything in the index.html that pulls the focus somehow ?

    Ho, and by the way, last time I used C2 inside a webpage, I prefered to use directly the canvas and start the runtime with onload :

    <div id="c2canvasdiv" width="990" height="207">
       <canvas id="c2canvas" width="990" height="207">
          <div id="c2canvas_off"></div>
       </canvas>
    </div>
    <script type="text/javascript"> 
       jQuery(document).ready(function () {
          cr_createRuntime("c2canvas");
       });
    </script>

    If it is the index that pulls the focus somehow, this would solve the problem.

    Thanks Guizmus!

    I'll look into it!

    That just might speed up loading and make the wepage lighter.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic Locked topic
0 Favourites
Construct 3 any news?
889 125,610
uzumiapps's avatar
uzumiapps
Unread hot topic
378 33,261
part12studios's avatar
part12studios
Unread hot topic
353 32,093
yojona's avatar
yojona