Layer as parent of hotspot

  • Hi
    I'm trying to hide/show a group of hotspots at a set. I thought I could make a hotspot a child of a container layer and just turn the layer on or off. This code works sometimes in version 1.0.8.15 and not at all in 1.6.19. Click the yellow box to create hotspots. Click the green box to show/hide. If I set hotspotbox to visible in the XML then all hotspots will be shown. If I set visible to false in the XML then all the hotspots will not be shown. However switch the value in an action does nothing.
    Is this supposed to work? My fallback is to set a flag in the hotspots and iterate through them looking for the flag.

    Gavin


    <krpano debugmode="true" onstart="showlog()">

    <!-- use a grid preview pano as background -->
    <preview type="grid(cube,16,16,512,0xCCCCCC,0xF6F6F6,0x999999);" details="16" />

    <!-- view settings -->
    <view hlookat="0" vlookat="0" fovtype="VFOV" fov="100" fovmin="60" fovmax="150" />


    <!-- layer and hotspots -->
    <layer name="hotspotbutton" type="container" align="right" x="0" y="0" width="50" height="50"
    onclick="trace('toggle compass'); switch(layer[hostspotbox].visible);"
    bgcolor="0x00FF00"
    bgalpha="1.0"
    bgcapture="true"
    />
    <layer name="hotspotbutton2" type="container" align="right" x="0" y="50" width="50" height="50"
    onclick="buildhotspot();"
    bgcolor="0xFFFF00"
    bgalpha="1.0"
    bgcapture="true"
    />
    <action name="buildhotspot">
    txtadd(hsn,"hs",get(plugin[hotspotbox].hscount));
    trace("build hotspot ",get(hsn));
    INC(plugin[hotspotbox].hscount);
    addhotspot(get(hsn));
    set(hotspot[get(hsn)].url,"../compass/compass.png");
    mul(hotspot[get(hsn)].ath,10,get(plugin[hotspotbox].hscount));
    set(hotspot[get(hsn)].atv,0);
    set(hotspot[get(hsn)].visible,true);
    set(hotspot[get(hsn)].parent,hotspotbox);
    </action>

    <layer name="hotspotbox" type="container" align="lefttop" width="100%" height="100%"
    visible = "false"
    maskchildren="true"
    children="true"
    hscount="0"
    />

    <hotspot
    name="hfs1"
    url="../compass/compass.png"
    ath="0"
    atv="20"
    visible="true"
    parent="hotspotbox"
    />

    <action name="setparent">
    trace ("set parent");
    set(hotspot[hs1].parent,hotspotbox);
    </action>

    </krpano>

Participate now!

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