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, January 31st 2016, 1:47pm

"onclick" doesn't work on layer type="container"

Hey.

I have four <layer> within on <layer type ="container">. When I assigned an action "onclick" to one of the <layer> it work fine. But when I assigned the very same action "onclick" on the root element <layer type="container">, then nothing happend. Why is it so ? How can I assign an action to the <layer type="container"> ?

Here is the code:


Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<layer name="textExplication"			url="plugins/textfield.swf"			keep="true"			visible="true"			align="top"			html="CLIQUEZ SANS RELACHER PUIS BOUGEZ LA SOURIS POUR NAVIGER DANS LA SPHERE.[br] VOUS POUVEZ AUSSI UTILISER LES FLECHES DU CLAVIER."			css="font-family:myFontRegular; color:#ffffff;font-size:15px; text-align:center;"			handcursor="false"			background="false"			scalechildren="true"			y ="30"
			/>

<!-- hotspots reaparaissent, et layer [explication] disparait -->
        <layer name="cross"                type="image"                url="img/cross.png"                keep="true"                align="topright"                scale="0.7"                onclick="set(hotspot[spot1].visible, true); set(hotspot[spot2].visible, true); set(hotspot[spot3].visible, true); set(layer[explications].visible, false)"

                />
        <layer name="arrows"                type="image"                url="img/arrows.png"                keep="true"                align="rightbottom"                handcursor="false"

                />
        <layer name="mause"                type="image"                url="img/mause.png"                keep="true"                visible="true"                align="leftbottom"                scale="0.9"                handcursor="false"                />


    </layer>

2

Sunday, January 31st 2016, 1:49pm

Oh shit, the code is messed up when I paste it here. In Sublime Text 3 it look good. Do you know if there is a way to "clean" the code with Sublime Text 3 ? Edit -> Line -> Indent doens't work so well.

3

Sunday, January 31st 2016, 2:52pm

hi,
where is the parent layer for layers cross, arrows, mouse in your code ?
For container type try bgcapture="true"

4

Sunday, January 31st 2016, 6:56pm

Hi,

layers "cross", "arrows", "mouse" are within layer "explications" type="container" such as:

Source code

1
2
3
4
5
6
7
<layer name="explications" type="container">

<layer name="cross"/>
<layer name="arrows"/>
<layer name="mouse"/>

</layer>


ah yea right, with bgcaputre="true" it's working when I click on the background. But I was expecting it to have an effect on the container + the layer which are insides. But it doesn't work so ?

5

Sunday, January 31st 2016, 8:36pm

If you assign action only to container, try to set to all childs enabled="false" handcursor="true"

6

Sunday, January 31st 2016, 10:22pm

But I would that the action happen to the container + everything which is in the container. Is copy / past this onclick action to every element in the container the only way to do so ? or is there an easier / cleaner way ?

7

Monday, February 1st 2016, 4:45am

Not sure what are you trying to achieve, try on container children="false"

8

Monday, February 1st 2016, 6:15pm

Thank you spelican. That's what I was looking for.

I have one container with layers inside. I wanted that when the user click anywhere on the container, the container disappear. Thanks to you it's working now. *thumbsup*