How do I have multiple C2 canvases & communication

  • Hello my friends

    Does someone tried to put multiple Construct2 projects in a one page (NOT IN IFRAMES!)? With no conflicts between the globals...

    And by experience, what is the best way to make a communication between JavaScript of the page with the Constract2 project? I guess plugin have to be made...

    Thank you.

  • You could also have multiple Canvases using Rojohound's Canvas plugin,

    That would work aswell

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could also have multiple Canvases using Rojohound's Canvas plugin,

    That would work aswell

    No, that is not what I asked.

    I want to have multiple Construct2 projects in a page, not multiple canvas-plugins in a project.

    When I say canvas I mean html5 element that is generated by exporting to "HTML website".

    My problem is that in order to insert the Construct2 project in my page I need to put it in iframe with the index.html with the canvas (html5 element) project.

    The problem of having iFrame is that it is hard to make JavaScript to JavaScript communication (page JS to JS inside the iframe), browsers blocking that for security reasons, the communication is super limited with workarounds.

    The other way is to put the canvas directly in the dom of the page, but then we have problems to have more than one Construct2 project because there will be conflicts between c2runtime.js globals of multiple projects.

  • Any help?

  • Why would you want to do such thing, If you want to have connection, you can always host a basic javascript server that relays input from one frame to another depending on a randomly generated user id, or maybe look into shared local storage, which could be your solution

    Edit: Have you tried putting two iframes and trying to set a key in one and get it in another with local storage

  • Why would you want to do such thing, If you want to have connection, you can always host a basic javascript server that relays input from one frame to another depending on a randomly generated user id, or maybe look into shared local storage, which could be your solution

    Edit: Have you tried putting two iframes and trying to set a key in one and get it in another with local storage

    Now not all devices support flash and browsers much more security-strict.

    I wanna have smart-ass popups on a page That can be loaded if needed.

    Those popups can be a range of things, from notification with fancy animations up to minigames.

    But I dont want to involve a server, it all should be on the client side.

    Thank you for your help, but sounds like you cant help me.

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