How do I know if panorama is fully loaded and ready to use from javascript?

  • I can use things like krpano().call(...) assigned to some HTML buttons and it works perfectly. But if I try it from window.onload, I have a javascript error:krpano().call is not a function.
    I could have used a few seconds delay before calling krpano() functions, but it is not really cool. Any ideas how can I check whenever krpanoSWFObject is ready to manipulate without causing javascript errors?

    Edited once, last by nmakarov (October 4, 2009 at 10:57 AM).

  • Hi,

    one way would be to check in JS if the krpano object and the function are available:

    js:

    Code
    if (krpano && krpano.call)
    {
    ...
    }


    or a other way - use a kind of 'start' javascript function and call it from krpano,

    js:

    Code
    function krpano_is_ready()
    {
    ...
    }


    xml:

    Code
    <krpano onstart="js( krpano_is_ready() );">
    ...

    best regards,
    Klaus

Participate now!

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