Adding an Event Listener(addEventListener)

0 favourites
  • 7 posts
  • 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?

  • add an onMessage event to my game to control game from there parent ==> I'd like to pause game from his container

  • For this type of development, you will probably want to use our Javascript SDK.

  • 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 directory

  • 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.

  • thanks for your helps,Now it's Ok

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks I have Use CallJs and It give me a solution by appending an EventLister from his js file

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)