How to call a javascript function and pass the krpano interface?

  • Hi all,

    I am trying to call a javascript function from anywhere in xml code without defining an Action and I want that function to have access to the krpano interface.

    Here is an example:

    Javascript code:

    Code
    function myjsfunction(krpano)
     {
      krpano.trace(1, "this is a test");
     }

    Xml code:

    Code
    <layer name="mylayer" onloaded="myfunctionaction()" type="container" keep="true" width="100" height="100" align="center" bgalpha="1" />
    <action name="myfunctionaction" type="Javascript">
      <![CDATA[
      myjsfunction(krpano);
      ]]>
      </action>

    I wish to get rid of the Action and do something like that:

    Code
    <layer name="mylayer" onloaded="js(myjsfunction(???))" type="container" keep="true" width="100" height="100" align="center" bgalpha="1" />

    How can I pass the krpano interface to the javascript function when using js() to call it?

    Best regards,

    Antoine

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!