Run functions JavaScript from krpano events

  • I'm considering the possibility of using Krpano for a project that is following my Studio. I then downloaded krpano Viewer 1.0.8.11 to run tests. In particular I need to execute some JavaScript functions from the OnMouseDown event but continues to give me the following error:

    Javascript call "jstest(mouse.x)" failed;

    What's wrong?

    The three sample files are:

    html file


    xml file


    panoramica.js file

    Code
    function jstest(mousex){ 
    alert(mousex); 
    }


    Thanks for the help

  • Thank you
    now the JavaScript function is invoked but in the message does not display the x-coordinate of the mouse, but the string mouse.
    How do I pass to the function the value of the position of the mouse?

  • Hi,

    passing the values directly there is not possible (at the moment),

    you could either build a calling string with the resolved values and then make the javascript call,
    e.g.

    Code
    onmousedown="txtadd(jscall,'jstest(',get(mouse.x),')'); js(get(jscall));"

    or don't pass the value and get the values from javascript side:
    xml:

    Code
    onmousedown="jstest();"


    js:

    Code
    function jstest()
    { 
    var krpano = document.getElementById("krpanoSWFObject");
    var mousex = krpano.get("mouse.x");
    alert(mousex); 
    }

    best regards,
    Klaus

Participate now!

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