How to create a polygon hotspot from Actionscript?

  • Hi,
    I am making a gui plugin for adding hotspots and linking panoramas that saves to a database.
    So far i can create image hotspots but i don't know how to create a polygon hotspot.

    I wasn't able to find how to do it in the docs or on the forum.

  • Thanx for the reply i made this function but it doesn't seem to create a polygon.
    Am i missing something?

  • Hi,

    adding the hotspot via addhotspot() and setting the points should be normally enough,
    but you code is bit wrong,

    see here the two set:

    Quote

    krpano.set("set(hotspot["+selected_hs+"].fillalpha", 0.25);

    either do this - calling the set() xml action - that means the full set action as string as parameter of the call function:

    Quote

    krpano.call("set(hotspot["+selected_hs+"].fillalpha, 0.25);");


    or do that - directly set the variable via the krpano set interface function: (recommended! better because faster)

    Quote

    krpano.set("hotspot["+selected_hs+"].fillalpha", 0.25);


    best regards,
    Klaus

  • Hi,

    that's more complicated,

    either by first copying all elements above the point index that should be deleted one index down,
    and then decreasing the count setting about one value,

    or by getting the internal array and calling the removeItem() function from it,
    e.g.

    Code
    var hotspotspointsarray:Object = krpano.get("hotspot[name].point");
    hotspotspointsarray.removeItem(index);

    best regards,
    Klaus

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!