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

Sunday, September 16th 2012, 7:39pm

Accessing Hotspot from Javascript

Hello,

I have 3 question related to hotspots behaviour.

1. How can I enumerate the names of all hotspots to be used in Javascript.

2. How can I modify a property of a hotspot (eg. alpha) from Javascript and also how can I read it.


Many thanks for your help,

Zephyr

Professional

Posts: 1,003

Location: Netherlands

Occupation: Web developer

  • Send private message

2

Sunday, September 16th 2012, 10:30pm

first make sure krpano is loaded, then

Source code

1
2
3
4
5
6
var krpano = document.getElementById('krpanoSWFObject');
var hotspot_count = krpano.get('hotspot.count');
for(i = 0; i < hotspot_count; i++){
      console.log(krpano.get('hotspot[ ' + i + '].name'));
      krpano.set('hotspot[' + i + '].alpha', 0.5);
}