Is it possible to use Javascript or a library like JQuery in the XML?

  • hey All,

    Again with the questions, right?

    So I am trying to force a javascript alert on a hotspot click event and it never fires. Am I missing something?

    <script src="pano.js"></script>

    <div id="pano" style="width:100%;height:100%;">
    <noscript><table style="width:100%;height:100%;"><tr style="vertical-align:middle;"><td><div style="text-align:center;">ERROR:<br/><br/>Javascript not activated<br/><br/></div></td></tr></table></noscript>
    <script>
    embedpano({swf:"pano.swf", xml:"pano.xml", target:"pano", html5:"auto", passQueryParameters:true});
    </script>
    </div>

    <script type="text/javascript">

    function clicker_hotspot() {
    alert("hotspot pushed.");
    }
    </script>

    <krpano>
    <image>
    <sphere url="Pano_14982.jpg" />
    </image>
    <view hlookat="90" vlookat="15" fov="100" />
    <hotspot name="stache"
    url="mustache.png"
    distorted="true"
    onloaded="calc_pos_from_hfov_yaw_pitch_roll(10, 180, 0, 0)"
    enabled="true"
    alpha="1.0"
    onclick="js(clicker_hotspot());"
    />
    </krpano>


    Thanks in advance.

    Stefan


    UPDATE:

    using the "o" key while viewing the Flash version I get the following:
    WARNING: js() - calling Javascript "clicker_hotspot()" failed: SecurityError: Error #2060

    So then I found the following https://helpx.adobe.com/flash-player/k…ash-player.html about scripting access while using flash.

    So I guess now the question is - how do I set up the ability to script in the flash player?

    I run this same project in HTML5 and it works great!~!!!~!!

    Thanks again,
    Stefan


    (: SOLVED MY OWN PROBLEM :)
    so in case anyone else has the same issues - check https://krpano.com/docu/xml/#security to learn about the Scripting security stuff that will solve this.

    Thanks all!

    Edited 2 times, last by b1naryb0y (February 27, 2015 at 10:19 PM).

Participate now!

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