We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Did We Break ExternalInterface with v2.0?

Home Forums Programming Did We Break ExternalInterface with v2.0?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #2382

    I have been experimenting with driving a scene from an external call in v2.0 of Verge3D. Something has changed.

    In earlier versions, the app was registered to the window as v3dApp.
    There was a line in the player code that reads:
    window.v3dApp = app;
    This is not present v2.0

    The v3dApp object was a convenient way to access the ExternalInterface namespace from outside of the scene.

    I don’t see a way of accessing the app or ExternalInterface with the standard code template.

    I can edit the template and add window.v3dApp, but am I missing something? Is there a new way to deal with external calls in v2.0?

    Jeremy Wernick


    Yes, v3dApp is no longer there, but you should be able to use the app object itself in the code like in the “External Call” demo:

    function runCode() {
        // add your code here, e.g. console.log('Hello, World!');
        // Run a Puzzles procedure 
        // Register a Puzzles-to-Code callback
        app.ExternalInterface.myJSFunction = function(a, b, c) {
            console.log(a, b, c)

    This won’t work when accessing from the browser console though. For this you can add window.v3dApp to the template like it was before.

    Co-founder and lead developer at Soft8Soft.


    I was using v3dApp as a communication channel between the V3D scene and the page that holds the iFrame. I my scenario, both the parent web page and the child iframe are served from the same domain, so the v3dApp object is a simple communications channel.

    I did edit my code and added window.v3dApp. It works well. Could this, or something like this, be added back to the core template code? I could be useful, but easy to forget if it is missing.

    V3DPlayer.prototype = Object.assign(Object.create(v3d.AppPuzzles.prototype), {
        constructor: V3DPlayer,
        onLoadFinished: function(sceneLoaded, logicLoaded, editorLoaded) {
            if (sceneLoaded) {
                window.v3dApp = app;

    Thank you. Great work!

    Jeremy Wernick


    Yeah, I think I understand the problem. For an application which loads different scenes in an iframe it’s needed to ensure that every V3D scene is accessible from the outside, which may be inconvenient.

    The main rationale behind this decision was to eliminate confusion in case of multiple applications running on the same page, because then window.v3dApp would refer to only one of them.

    We’ll think about returning it back, maybe in the form of a more consistent solution, than it was before.

    Co-founder and lead developer at Soft8Soft.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.