Sie sind nicht angemeldet.

1

Montag, 23. Juli 2012, 21:06

Create unique identifier inside the viewer

I'm looking for a way to generate an unique string inside the viewer, in similar manner to the uniqid() function of the php programming language, where it's assured the uniqueness of the variable based on the current time.I already made something like that by using a start number that's passed trough the javascript interface, however this approach is external to the viewer and error prone.
Hope there's a way to do it...
Thanks a lot.

Beiträge: 1 857

Beruf: Virtual Tours - Photography - Krpano developer

  • Nachricht senden

2

Montag, 23. Juli 2012, 23:48

Include an xml that is dynamic.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

3

Donnerstag, 26. Juli 2012, 11:26

Hi,

in the most cases using the runtime in milliseconds plus a random value can be used for generation an unique name...

e.g.

Quellcode

1
2
3
4
mul(tmp, random, 10000);
roundval(tmp);
txtadd(varname, 'var_', get(timertick), '_', get(tmp));
set(get(varname), ...);


additionally also a counter could be used, that will be increased on each call...

see also:
http://krpano.com/docu/actions/#timertick
http://krpano.com/docu/actions/#random

best regards,
Klaus