Global variables

0 favourites
  • 14 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • 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

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

    demo (capx)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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:

    I added the html/javascript-lines below after exporting the project:

    <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.

  • 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.

  • 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?

  • On start of layout perhaps? Look at either the events in the browser object, or system events like on start of layout.

  • 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:

    http://arrall.com/c/?i=13

    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.

  • Example:

    http://arrall.com/c2/passvarv2/

    Here is an example with no 3rd party plugins. (I hope) You pick a scale and an opacity offset and it sends it to the second app. I assume you could make the textboxes in the second app invisible/offscreen. It is a combo of php, javascript, and construct 2. But very little code to pull it off.

    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.

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