How do I listen for a loaded event from html ?

0 favourites
  • 3 posts
  • Hi !

    I am quite new to C2. It seems very powerful.

    I have a need that might be unusual. I know there is already a loader embeded in C2.

    I just don't want to show my canvas in my html page until the loading is completely finished.

    Is there an event that can be caught at the end of the loading ?

    Or maybe a way to call a JS function from the html after the loading ?

    Thx.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There are ways to do this.

    First, you can add a display:none on your <canvas> in the php/html directly. This way it won't be displayed at first.

    Then, in C2, add an event "On start of layout" with the action "ExecJS" from the Browser object. This way, you can call a function that you declared on the page.

    Be careful though, read the manual concerning ExecJS, as there are security issues. If possible, don't use it at all.

  • Thank you Guizmus.

    It seems that the "Execute Javascript" action of the "Browser" object is what I need.

    I'm gonna try this.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)