set hlookat from (external) javascript

  • It's been a long time since I worked in krpano and I have a problem:
    I need to orient a 360 to the magnetic north.
    I have a script in the parent page e.g.:
    function myLocation(){
    console.log('test')
    return '30' //deviation from the magnetic north - dummie value
    }

    If I run this function from my hlookat, it returns/logs nothing
    (<view hlookat="js(myLocation())" ...)

    I can run it from <scene onstartup="js(myLocation())"
    That actually runs the console.log.

    I also tried it this way, but to no result:
    <script>
    embedpano(
    {
    xml:"tour.xml",
    target:"pano",
    onready:function(krpano) {
    krpano = krpano.get("global");
    krpano.set("view.hlookat", 30);
    }
    }
    );
    </script>


    So, long story short: how do I pass a value to hlookat from the parent-page?

    thanks

    Einmal editiert, zuletzt von kvd (28. November 2023 um 13:37)

  • document.getElementById('krpanoSWFObject').call('set(view.hlookat, 30)')


    (Maybe you want to call a custom function instead, which makes sure everything needed is loaded before setting the view)

    Einmal editiert, zuletzt von s-maier (28. November 2023 um 19:29)

Jetzt mitmachen!

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