Adding an Event Listener(addEventListener)

Discussion and feedback on Construct 2

Post » Tue Jun 26, 2012 11:05 am

HI all,
I'd like to add an Event Listener to catch message from other application like parent container of my game like an iframe I have used call js plugin to send Message from game to parent application with parent.postMessage('score','*');
is there any method to catch message from other domain?
B
5
S
1
Posts: 49
Reputation: 723

Post » Tue Jun 26, 2012 11:36 am

add an onMessage event to my game to control game from there parent ==> I'd like to pause game from his container
B
5
S
1
Posts: 49
Reputation: 723

Post » Tue Jun 26, 2012 12:00 pm

For this type of development, you will probably want to use our Javascript SDK.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Tue Jun 26, 2012 12:13 pm

@Ashley :
please can you help me to install this sdk in my construct :
I have do this instruction but it doen't work for me:
-->download sdk,
-->close constrcut2,
-->unzip sdk folder into plugins directorybouguima2012-06-26 12:14:00
B
5
S
1
Posts: 49
Reputation: 723

Post » Tue Jun 26, 2012 12:36 pm

The thing you downloaded is just a plugin/behavior template, to give you a quick guide/starting files to make either a plugin and/or a behavior.

If you want to make a plugin, be sure to only unzip the "Plugin template" folder into your "exporters/html5/plugins" folder. Else go for the "behavior template" in the "behaviors" folder.

If you now launch C2, you should be able, in the "Insert object" dialog, to see a "plugin template" object that you can add to your project.

As it is though, this plugin won't do much.
You need to open the .js files in a notepad and edit them to add the relevant code.

That's where the SDK manual (the link in Ashley's post) really comes in handy.

I hope this helps you getting started.
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,999
Reputation: 57,793

Post » Tue Jun 26, 2012 2:15 pm

thanks for your helps,Now it's Ok
B
5
S
1
Posts: 49
Reputation: 723

Post » Thu Jun 28, 2012 12:13 pm

Thanks I have Use CallJs and It give me a solution by appending an EventLister from his js file
B
5
S
1
Posts: 49
Reputation: 723


Return to Construct 2 General

Who is online

Users browsing this forum: saiyadjin and 4 guests