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.
Since r85 this is possible with using the ID of elements - eg a TextBox in C2.
Awesome demo —
you can save program in version r84, that can't download r85
Sorry, this is not possible.
The id-property is a new feature in r85.. (see the 'Adds' for r85)
i export program that generates input noting file capx and see more, i want know someone used html file?
Outside C2 - index.html:
<img src="http://dl.dropbox.com/u/31151399/Construct2/forum/passVarViaId/screenShotIndexHtml.png" border="0" />
Inside C2: The TextBox in C2 has the ID myTextBoxInC2
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.
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.
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?
On start of layout perhaps? Look at either the events in the browser object, or system events like on start of layout.
Develop games in your browser. Powerful, performant & highly capable.
I wanted to pass a variable into C2 via the URL to load the page (like youtube.com/?v=###.) I used the method explained here to call doIt(); in my loading screen and extended it using a tiny amount of php. Thankfully, C2 did not complain when I changed index.html and game.html into php files.
This (should be) a working example:
In the example, the code checks to see if a variable was passed. If so, it skips the login screen, silently logs in as the guest/guest user, and then loads the correct node.
I realize this post is old, but if I had found this post while reading the FAQ post it would have saved me some time.
arrall soooo.. technically i should be able to solve this issue with your solution... let's give it a go I'll let you know.
I'm still not sure how to load a graphic from a base64 in Construct 2. But sending the string between apps should not be a problem.
You don't always need 2 apps either. In the brainstorming app I was showing, it would be possible to have it navigate back to the same app with a different node-id passed based on whatever was pressed in the app.
Also posted this to Ragevortex 's issue.