Execute actions in c2 runtime from js

Get help using Construct 2

Post » Wed Mar 07, 2012 3:21 pm

Hi,
I am new here (and french so sorry for my English ).

I suceeded in calling external JS function from c2 thanks to theCallJS plugin.

Is there a way to trigger actions in c2 runtime (functions, variables value changes, etc...) from JS in my html file ???

Thx for any advice !!
B
5
S
1
Posts: 19
Reputation: 488

Post » Wed Mar 07, 2012 5:48 pm

@simpleex : one way to do that , while still using CallJS, is to have a variable in your page, and read the value of that variable with CallJs inside C2. With taht, you can react and start various reaction depending on the value of that var.
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Wed Mar 07, 2012 6:13 pm

@Pode : Thx for your reply, but I think my post was not very clear !

Let's say I have a JS and a form button for example in my index.html (outside C2).

Is there a way for this button to trigger or modify something (Object, variable,...) in C2 canvas ???

Thx
B
5
S
1
Posts: 19
Reputation: 488

Post » Wed Mar 07, 2012 6:26 pm

@simpleex : your button can set a var inside index.html. And since the communication is bidirectional with CallJS, C2 can check the value of that var, and react accordingly.
B
33
S
9
G
6
Posts: 709
Reputation: 6,704

Post » Thu Mar 08, 2012 8:29 am

I understand that but it means I have to check var every second or every tick within C2 ?
B
5
S
1
Posts: 19
Reputation: 488

Post » Thu Mar 08, 2012 8:34 am

Try Function plugin, "action: Inject JS function objects".
It was designed for communication between js function and event sheet.


I think that it is possible to call any plugin's action in js code, but it's a rare case since most users using C2 is not to learn how to write code.rexrainbow2012-03-08 08:47:32
B
97
S
22
G
178
Posts: 4,120
Reputation: 104,047

Post » Thu Mar 08, 2012 9:30 am

Thx, I am trying this to make Punub work with C2, if someone can help !?
B
5
S
1
Posts: 19
Reputation: 488

Post » Thu Mar 08, 2012 9:45 am

Typo : Pubnub
B
5
S
1
Posts: 19
Reputation: 488

Post » Thu Mar 08, 2012 9:48 am

@simpleex

What's it? And what's your plan?
B
97
S
22
G
178
Posts: 4,120
Reputation: 104,047

Post » Thu Mar 08, 2012 10:02 am

Pubnub site : http://www.pubnub.com/

"The PUBNUB object is a Publish + Subscribe Push Framework for JavaScript."

The plan is to send and receive socket messages
B
5
S
1
Posts: 19
Reputation: 488

Next

Return to How do I....?

Who is online

Users browsing this forum: emoticon, KeetonCat, makkancs, Matthew de and 25 guests