javacript caller and resolve?

  • Hi,

    but how do you get caller and resolve if you define a krpano action in js itself?

    That's currently no documented, but there is a 'krpano.actions.actioncaller' variable which points to the caller object (when there is one, otherwise it is null).

    A 'resolve' function is not available in that context, but here a simple get() could be used instead - when get() returns null use the name of the variable as value.


    is there a way to use such actions like asyncloop with js code?

    Sorry, that works only with actions code.
    What you could do is either using jscall() in the loop code or adding a custom JS function and calling that in the loop code.

    Best regards,
    Klaus

  • thanks klaus,

    all clear...

    but i have another one...

    Code
    screentolayer(get(caller.name), mouse.stagex, mouse.stagey, currentx, currenty);


    i guess setting js variables directly doesnt work in such cases, right?

    so this translates to:

    Code
    krpano.actions.screentolayer(krpano.actions.actioncaller.name, krpano.mouse.stagex, krpano.mouse.stagey, 'currentx', 'currenty');
    krpano.trace(0, krpano.currentx + '/' +  krpano.currenty);


    is that correct?


    plus one more...
    in xml action script you check an unset variable with

    Code
    if(variable === null, ... );


    but a direct use of this in js does not work because in javascript null !== undefined
    is it correct that the above line translates to...

    Code
    if(variable === undefined || variable === null) { ...  }


    ?

    best, index

Jetzt mitmachen!

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