Condition from function

For developers using the Construct 2 Javascript SDK

Post » Fri Dec 21, 2012 5:26 am

Hi All,

I'm working on a Windows Phone integration.

Currently I can fire JavaScript functions from the C#, allowing me to identify events like pressing the back button.

My problem is that I don't know how to get a fired function to trigger a condition.

When I call this from inside the function:

this.runtime.trigger(cr.plugins_.windowsphone.prototype.cnds.OnBack, this);

Runtime is just undefined.

Any help would be great.
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783

Post » Fri Dec 21, 2012 2:06 pm

You just need access to the real 'runtime' object to be able to call 'trigger'. 'runtime' is a property of all object instances and types, so it works in plugin functions, but if you create a standalone function or your own object you need to make sure you have a way to access 'runtime'.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,498

Post » Fri Dec 21, 2012 3:47 pm

@Ashley Excellent, thanks for the help. I got it working.

You pointed me in the right direction, and when looking at the Appmobi plugin I was able to see how you'd done it there. Great stuff, I can sleep again.
Moderator
B
72
S
13
G
11
Posts: 900
Reputation: 11,783


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests