Hello all!
I'm playing with KRPano and for some technical and performances reasons, I decided to work in XML file with both Javascript and Native actions.
Today, I'm struggling hard to get the things work together! :)
Calling is an javascript-type action from a standard KRPano native-action is straight forward:
<action name="caller">
callee();
</action>
<action name="callee" type="javascript">
console.debug("yeepee");
</action>
But for some technical reasons, it's more complicated the other way:
<action name="caller" type="javascript">
krpano.call("callee()");
</action>
<action name="callee">
trace("yeepee");
</action>
When the Big Deal comes, it is when we start talking about parameters... Once again, Native-to-JS is trivial, but the other way is not.
I ended to this point: because I must give my actions arrays, I instanciate arrays in calls before to call the expected actions:
<action name="caller" type="javascript">
var val1 = "plouf";
var val2 = 4*6;
krpano.call("def(my_array, array);set(my_array[0], "+val1+");set(my_array[1], "+val2+");callee()");
</action>
<action name="callee">
trace("Provided values are:", get(my_array[0]), " / ", get(my_array[1]));
</action>
I'm not sure this is very optimal ;) and it looks very.very ugly :D
Do you know a better way?
Image I work with very long arrays I have to declare in loops and construct a call-string before to launch the action... This is very poor in performance. :/
Best regards and thanks for your enlightened help!