Here's the jist. We're creating a webpage, with a little bit of HTML & CSS (modals). We've made a back-end with API and the javascript from the page should load the data (via the API) locally. Now we modify and can work with the data (just on like any site).
Now I want my data i just brought in to be able to be used by construct2 and vica versa, be able to do calls to Construct 2 from our JS, and the other way around (from our JS to Construct 2). All of this will be inside an IFrame.
For example:
The game starts, construct 2 game runs in the background (some cars are moving around) while the first html & css modal appears on top of the construct 2. This is going to be a small questionnaire modal (age, where you're from, gender, ...) and all will be handled outside of the game/construct (the game is still running automatically in the back ground).
But then when the user completes his "registration" and clicks a button in html5/js ('Go to Game' or something), i have to trigger something in construct 2 so that the game goes from layout 1 to layout 2. I already know how to do this INSIDE construct 2, which is easy, but now i want it to work so that when a user presses a button in html5, a construct 2 function/event is called.
Example 2:
The game starts, does it's thing and after a certain period, say 5 seconds, another modal pops up with a question for the user. When he answers the question by clicking a button (in html5/js), the modal will disappear and something in construct 2 has to be triggered so that the car moves forward. When the car hits a certain point, another call has to go out from Construct 2 to our JS so that another modal may pop-up. etc...
Does anyone know how to do this exactly?