Scope of layer names

  • Hi everyone,

    I am using the image gallery from the Examples page in one of my projects (https://krpano.com/releases/1.20.9/examples/#image-gallery).

    Basically what it does is creating layers for the background and the included images, right? So I thought, that it should be possible to access these layers from my main tour.xml-file. Turns out, that they are not so easy to find *confused* . I think it might has something to do that these layers for the gallery are created in the external thumbbar.xml file. Maybe it has something to do with the scope of these layers, similar to the scope of variables declared within functions in "normal" programming languages?

    I little background why I want to access these layers: I am creating a little search game for kids with krpano. I have hidden hotspots, that turn in to a small green "check" sign, when the kids click the right area. I also included the image gallery to show which features they should search. If they find the feature in the panorama, I would also like to put the "check" sign on the respective image in the image gallery.

    Could someone guide me in the right direction to accessing variables/layers that were created from external xml-Files please?

    One work around might be to copy the content of the whole thumbbar.xml in the main tour.xml, but I would like to avoid that if possible. I think this would decrease the readability unneccessary.

    Thanks in advance
    Martin

  • Thats what I thought initially, but unfortunately I couldn´t manage to address the layer. When I use the function debugvar(layer) or debugvar(plugin) I get the info, that the array of layers has 6 entries. If I go trough them all with

    Code
    debugvar(layer[i].name)

    , I can see all the layers that I added myself. However the thumb gallery layers don´t appear in this list. If I try to address them with their name, which should be "thumbbar" for the container background and "thumbbar_image_i" for the i-th image, I get the debug info "undefined".

    On the other hand you can still click the images from the thumb bar and they get enlarged. So the must be in the system somwhere.

    Am I missing something?

  • I just figured out, that I called the debugvar() function from within the scene. If I put the function call outside the scene element I could find the thumbbar layer and all the image layers. However it is not clear to me why it didn´t work from within the scene... *confused*

Jetzt mitmachen!

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