You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Tuesday, October 22nd 2019, 4:52pm

Pass array object by js function

Hi

is it possible pass array (points of polygonal hotspot) by js function?

I tried:
js(proxy.sendArray(get(hotspot[poly].point)))
And does not work :/

Do you have any idea, how to recieve array in sendarray method in js file.

Greetings

2

Tuesday, October 22nd 2019, 5:08pm

1) get() maybe wont work like this, i guess it should be krpano.get()
2) hotspot[poly].point is probably a krpano array not a native js array, so you might need hotspot[poly].point.getArray()
3) dont forget: js() takes a js call, you cant work there like in krpano xml scripting

https://krpano.com/docu/plugininterface/#array

untested, but i would try:
js( "proxy.sendArray(krpano.hotspot.getItem('poly').point.getArray());" );

3

Wednesday, October 23rd 2019, 9:40am

Thank you for help it works!! but the solution is not what I wanted. I would like to pass array points to js method from krpano actions like this:

<action name="testAction">
// get(hotspot[poly].point) -> in krpano xml actions I got [object object] and possible to iterate
js(proxy.sendArray(hotspot[poly].point));
js(proxy.sendArray(hotspot.getItem('poly').point.getArray()));
</action>

js
function sendArray(array) {
array // null or hotspot[poly].point as string or [object object] as string but i expect array object here :)
}


is It even possible?