Sie sind nicht angemeldet.

  • »Alexey Tkachenko« ist der Autor dieses Themas

Beiträge: 702

Wohnort: Sevastopol, Crimea, Russian Federation

Beruf: Interpreting, Building virtual tours

  • Nachricht senden

1

Mittwoch, 30. Oktober 2013, 11:18

How to remove array item.

Hi, guys! I need a bit of advice *smile*

Is it possible to delete an array item from the static array? I've tried removearrayitem(); action but it always returns "unknown action 'removearrayitem'". Docu says this action is "also callable from XML / krpano Actions.". So I'm confused whether this action works only for plugins or not... *wacko*
Regards,

Alexey

2

Montag, 4. November 2013, 08:46

Hi,

the removearrayitem() function is a property of the array itself:
http://krpano.com/docu/plugininterface/#array

It would need to be called this way:

Quellcode

1
arrayname.removearrayitem(itemname);


e.g.

Quellcode

1
2
3
4
5
6
set(myarray[item1], ...);
set(myarray[item2], ...);
set(myarray[item3], ...);
trace(myarray.count);
myarray.removearrayitem(item2);
trace(myarray.count);


Best regards,
Klaus

  • »Alexey Tkachenko« ist der Autor dieses Themas

Beiträge: 702

Wohnort: Sevastopol, Crimea, Russian Federation

Beruf: Interpreting, Building virtual tours

  • Nachricht senden

3

Montag, 4. November 2013, 08:54

Thank you a lot, Klaus! I'll try this!
Regards,

Alexey

4

Sonntag, 8. Dezember 2013, 18:16

Hi Klaus!
Is it possible to remove the element of two-dimensional array?
Something like this:

Quellcode

1
arr.removearrayitem(0,3);

5

Montag, 9. Dezember 2013, 08:19

Hi,
Is it possible to remove the element of two-dimensional array?
In the krpano xml data structures there exists no two-dimensional arrays...

Best regards,
Klaus

  • »Alexey Tkachenko« ist der Autor dieses Themas

Beiträge: 702

Wohnort: Sevastopol, Crimea, Russian Federation

Beruf: Interpreting, Building virtual tours

  • Nachricht senden

6

Montag, 12. Februar 2018, 09:33

Hi, Klaus!

Now that we have the cool value arrays , I wonder what is the correct way to remove an item from such value array. I tried arrayname.removearrayitem(index); but this doesn't work (or maybe I do something wrong here).
Regards,

Alexey

7

Dienstag, 13. Februar 2018, 22:12

Hi,

there is no API for removing items from value arrays yet, but in the next release the delete action will be able to do that.

But if you want you could also extent krpano with a custom action for this:

Quellcode

1
2
3
<action name="delete_value_array_item" type="Javascript">
  krpano.get(args[1]).splice(args[2],1);
</action>


E.g. test code:

Quellcode

1
2
3
4
5
6
7
8
def(test, array);
set(test[0], i1);
set(test[1], i2);
set(test[2], i3);
debugvar(test);
delete_value_array_item(test,1);
//delete(test[1]);   // or this with the next krpano release (1.19-pr15)
debugvar(test);


Best regards,
Klaus

  • »Alexey Tkachenko« ist der Autor dieses Themas

Beiträge: 702

Wohnort: Sevastopol, Crimea, Russian Federation

Beruf: Interpreting, Building virtual tours

  • Nachricht senden

8

Mittwoch, 14. Februar 2018, 07:32

Thanks, Klaus!

You're helpful as usual! ;-)
Regards,

Alexey