storing hotspots in an array

  • The documentation states that array contains objects, not values so I should be able to story my hotspots in the array and access hotspot attributes but I am so so confused about the correct syntax:

    addhotspot(get(hname));

    set(hotspot[get(hname)].ath, 0.2);

    <!-- setting the first element of the array to the new hotspot -->

    set(arr[0], get(hotspot[get(hname)]));

    trace('hotspot=', arr[0]);

    trace('hotspot ath=', get(arr[0].ath));

    trace('hotspot ath=', arr[0].ath);

    I get:

    hotspot = [object krpano_hotspot]

    hotspot ath = null

    hotspot ath = arr[0].ath


    Why am I not getting 0.2, which is the 'ath' of that hotspot? *confused*

  • Hi,

    this code is not possible:

    Code
    set(arr[0], get(hotspot[get(hname)]));

    It's not possible to copy an element from one array to another one.

    Each array will be always an array of objects/item - and each item always have automatically unique name and index properties.
    That means to write to an array item, always a array item property need to be used.

    Best regards,
    Klaus

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!