Global variables

Get help using Construct 2

Post » Wed Apr 04, 2012 4:25 pm

Hello, I have a question I have exported a file where I construct 2 generates the c2runtime.js and index.html, I modified the index.html file to generate an application multicanvas, but my problem and if not will be able to do is to through a file. "js" pass global variables to the file c2runtime.js and then I return the final values ??of the variables for power after handling.

thanks
B
4
Posts: 11
Reputation: 472

Post » Wed Apr 04, 2012 5:47 pm

Since r85 this is possible with using the ID of elements - eg a TextBox in C2.

demo (capx)
B
14
S
6
G
5
Posts: 173
Reputation: 4,742

Post » Wed Apr 04, 2012 6:48 pm

Awesome demo @Joe7.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Mon Apr 09, 2012 7:59 pm

you can save program in version r84, that can't download r85
B
4
Posts: 11
Reputation: 472

Post » Mon Apr 09, 2012 8:54 pm

Sorry, this is not possible.
The id-property is a new feature in r85.. (see the 'Adds' for r85)Joe72012-04-09 20:55:59
B
14
S
6
G
5
Posts: 173
Reputation: 4,742

Post » Mon Apr 09, 2012 9:34 pm

i export program that generates input noting file capx and see more, i want know someone used html file?
B
4
Posts: 11
Reputation: 472

Post » Tue Apr 10, 2012 8:43 am

Outside C2 - index.html:
I added the html/javascript-lines below after exporting the project:


Inside C2: The TextBox in C2 has the ID myTextBoxInC2

Joe72012-04-10 08:47:39
B
14
S
6
G
5
Posts: 173
Reputation: 4,742

Post » Tue Apr 10, 2012 2:25 pm

as I can get the value of a variable created in construct 2, through a special html code. Suppose a text or any global variable.
B
4
Posts: 11
Reputation: 472

Post » Mon Oct 29, 2012 6:42 pm

Hey,
Thanks to your example I can easily get the data to pass into construct with a button click. I'm having issues with getting it to pass in when the page loads.
B
2
Posts: 1
Reputation: 502

Post » Sun Mar 03, 2013 7:40 pm

Hi,
I'm backing sadjeff here : thanks to joe7's example it's possible to pass data with a button click. But would it be possible to do so when the application loads for instance?
B
8
S
4
G
5
Posts: 32
Reputation: 2,816

Next

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, abdalghani, imothep85, Marxally, Virpoja and 25 guests