How do I listen for a loaded event from html ?

Get help using Construct 2

Post » Tue Mar 04, 2014 10:42 am

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.
B
4
Posts: 5
Reputation: 210

Post » Tue Mar 04, 2014 1:01 pm

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.
B
17
S
8
G
4
Posts: 461
Reputation: 6,157

Post » Tue Mar 04, 2014 4:21 pm

Thank you Guizmus.
It seems that the "Execute Javascript" action of the "Browser" object is what I need.
I'm gonna try this.
B
4
Posts: 5
Reputation: 210


Return to How do I....?

Who is online

Users browsing this forum: Lancifer and 49 guests