Javascript action call function inside Krpano action ?

  • Hello everyone,
    I would like to understand if it is possible to call a function inside an object inside a javascript action, the simplified code is this:

    Code
    <action name="engine" type="javascript" autorun="onstart">
    <![CDATA[  var Move = {  totalmove: 0,	status: true,  start: function () { // some actions  },
            stop: function () { // some actions  }
        };
    ]]></action>

    I should call the functions Move.start () and Move.stop () from krpano actions


    I prevent the speech of implementing the script in an external .js file (which works), for some combinations ( panotour) I must necessarily use in the xml file as js action ( always if it is possible )


    Thanks a lot *smile*


  • hi always used
    js, jsget, jscall

    https://krpano.com/docu/actions/#js


    take a look at webvr.xml file which has a load of javascript code

  • Instead of this part of your code:
    var Move =.......
    use this code:
    window.Move =.......
    (by this way, you can define the Move object as a global object)
    After this change, you can use these codes to run your functions:
    jscall(Move.start());
    OR
    jscall(Move.stop());

    I hope it works for you.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!