[plugin] rex_frame_message

  • The idea of this plugin is came from Pode 's postMessage plugin.

    Each project is running in a frame, which could be addressed by a frame name in this plugin. Since iframe could be added into layout to run other project by URL, it is possible to have multiple frames in an environment.

    This plugin could send or receive function calls from other frames, i.e. communicate between projects.

    Document, included plugin and sample capx.

  • i am away at the moment so i cant test this. Does this mean each frame will run at the same time?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • spongehammer

    Yes, each frame runs at the same time, but the tick of each frame is individual. The communication between frames is asynchronously, like network.

  • Designer could plan this kind of architecture -

    • a main frame to control the main menu
    • a child frame to display each level which made by individual project (capx) , and communicate between main frame by this plugin.

    It could only load resource of a level, not all levels.

  • Here are sample capxs to show how to recognize the main frame.

    Daughter, mother

    Daughter (child frame) will be embedded into mother (main frame), how to recognize the main frame from child frame?

    A possible solution is using frame message plugin -

    In daughter capx,

    1. call function "Mom?"

    2. wait 0.1 second

    3. check the global variable "FindMyMom"

    And this capx has a return handler of "Mom?" which sets global variable "FindMyMom".

    In mother capx, it has a function body "Mom?" which return a value to daughter.

    If the daughter frame is not embedded in mother frame, the return handler of "Mom?" will not be triggered, so global variable "FindMyMom" will not be set.

  • A thousand thank you's, rexrainbow! I had been trying for several days to get my iframe-embedded page/project to communicate with the parent page/project by using localstorage keys. It worked sometimes--and sometimes not. Then it wouldn't work at all...

    As soon as I used your plugin, however, to use the embedded page to call a function in the parent page, it worked immediately. I almost fell out of my chair. Thanks again!

    Edit: I did more testing with different functions and in different browsers. It works so well that I wonder why it's still in the "Work In Progress Addons" section.

  • terransage

    This plugin had too few users. As you saw, there were only 3 users included me in thread, therefore I had forgot this plugin before.

    BTW, thanks for your testing.

    Kyatric

    Please help me move this thread to completed addons section,

  • Moved as requested.

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