Sie sind nicht angemeldet.

1

Donnerstag, 4. September 2014, 09:03

about krpano.set

Quellcode

1
2
3
4
krpano.set("g",100); 
krpano.call("trace(g)"); 
krpano.set("g",200); 
krpano.call("trace(g)");


result:

200

200

why is not :

100

200

2

Donnerstag, 4. September 2014, 09:22

Hi,
  • set() and get() are 'sync'
  • but call() just puts the given commands into a queue and execution of the commands in this queue is 'async' and depends on the other currently running commands
That means in your case the trace calls are executed when the value of 'g' already has the value 200.

Best regards,
Klaus

3

Donnerstag, 4. September 2014, 10:11

Hi,
set() and get() are 'sync'but call() just puts the given commands into a queue and execution of the commands in this queue is 'async' and depends on the other currently running commands
That means in your case the trace calls are executed when the value of 'g' already has the value 200.




Thx for replying.

I got it,

that's why the variable "gx" always return the same value.

But how can i do to get a different value?

Quellcode

1
2
3
4
5
6
7
8
9
10
11
for (var i = 0; i < 3; i++) { 
var point = krpano.get("hotspot[" + i + "]"); 
krpano.call("spheretoscreen(point.ath,point.atv,gx,gy);"); 
var gx = krpano.get("gx"); 
var gy = krpano.get("gy"); 
var p = { 
"x" : gx, 
"y" : gy 
}; 
hotspotpoint.push(p); 
}

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »boxui« (4. September 2014, 11:39)