[solved] Read C2-variable from Htmlsite

Get help using Construct 2

Post » Tue Oct 25, 2011 3:37 pm

Hi,
is there an easy way for getting the value of a variable(global or local) in the parent- html-page?
ie:
cr.createRuntime("c2canvas");
alert(cr.instance_vars[1]); // doesn't work
alert("The value is:" + myGlobalVar); // doesn't work

If not, perhaps its possible to

1) to set a value "really global" through a plugin or
2) read the "local storage" from the html-Page.


thanx, Joe7Joe72011-10-31 17:09:14
B
14
S
6
G
5
Posts: 173
Reputation: 4,742

Post » Tue Oct 25, 2011 5:06 pm

@ Joe7: you might wanna take a look at The ajax tutorial. (you may also check this topic out).

This works with PHP.
Plain HTML won't allow you any communication.
But I guess you can have javascripts in your HTML file that will respond to the ajax calls (make a web search to check if it is possible).
Kyatric2011-10-25 17:06:54
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: 6,998
Reputation: 57,791

Post » Tue Oct 25, 2011 5:15 pm

The best thing to do is to make your own plugin with the SDK at the moment - you can't call between Construct 2's runtime and the page any other way right now.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Fri Oct 28, 2011 10:08 pm

thanks,
i'll try to do this with a plugin
B
14
S
6
G
5
Posts: 173
Reputation: 4,742

Post » Mon Oct 31, 2011 12:20 am

Plugin is written.

passC2ValueJoe72011-10-31 00:20:40
B
14
S
6
G
5
Posts: 173
Reputation: 4,742

Post » Mon Oct 31, 2011 7:58 am

Thank you very much =) I have no idea, how to use it but ... when I need it, it's there =D
B
17
S
4
G
4
Posts: 94
Reputation: 3,058

Post » Mon Oct 31, 2011 5:00 pm

Very useful ! It's going to help to have a better integration between the C2 playground and the surrounding website, when trying to make something a bit different from a game, but close to an "app".
B
33
S
9
G
6
Posts: 709
Reputation: 6,704


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 2 guests