Sie sind nicht angemeldet.

1

Dienstag, 28. Oktober 2014, 17:53

AUTOTOUR - How to switch ON /OFF with a button

Hi,

I'm using the AUTOTOUR Event into my project and I'd like to add a Button that could switch the AUTOTOUR.

Here is my code :

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
	<!-- Mise en place Swith Automatique des Scènes -->
	<events name="autotour"  keep="true"
    	autotour="
            	add(sceneindex,scene[get(xml.scene)].index,1);
            	if(sceneindex == scene.count, set(sceneindex,0); );
            	loadscene(get(sceneindex),null,merge,blend(0.7));"/>

	<!-- layer pour afficher l'icone de la navigation automatique -->
	<layer name="autotourOn" url="images/autorotate.png"  align="rightbottom" x="210" y="90" keep="true" zorder="-1" onhover="showtext(Visite Manuelle, info-bulle);" onclick="delayedcall(0.1,autotour.pause();)"/>

	<!-- layer pour afficher l'icone de la navigation automatique -->
	<layer name="autotourOff" url="images/autorotate.png"  align="rightbottom" x="270" y="90" keep="true" zorder="-1" onhover="showtext(Visite Automatique, info-bulle);" onclick="delayedcall(0.1,autotour.reset();)"/>

As you can see, for the moment I have 2 buttons :

1 : Autotour is On
2 : Autotour is OFF

I'd like to have only One button that could swith ON/OFF the Autotour.

I know that there is "switch" option, but how to implement it ?

Thanks for your help. *smile*

2

Dienstag, 28. Oktober 2014, 19:33

You can try something like this:

in events AUTOTOUR add play="true", for layer autotourOnOff define onclick="switch_autotur();", and add 'switch_autotur' action.

Quellcode

1
2
3
4
5
6
7
8
9
10
11
<events name="autotour"  keep="true"
play="true"
...
</events>

<layer name="autotourOnOff" ... onclick="switch_autotour();"/>

<action name="switch_autotur"
	if( event[autotur].play, delayedcall( 0.1, autotour.pause() ), delayedcall( 0.1, autotour.reset() ) );
	switch( event[autotur].play, true, false );
</action>


This source is not tested, but maybe it works *smile*

3

Donnerstag, 30. Oktober 2014, 15:09

Hi Thanks for your feedback.

I've test your solution, but it doesn't work ...and as I'm not vere good in code, could please help me ? *unsure*

Many thanks. *smile*

4

Donnerstag, 30. Oktober 2014, 15:41

Ok here is the solution doing by my own :

Quellcode

1
2
3
4
5
6
7
8
	<!-- Mise en place Swith Automatique des Scènes -->
	<events name="autotour"  keep="true" play="true" enabled="true"
    	autotour="
            	add(sceneindex,scene[get(xml.scene)].index,1);
            	if(sceneindex == scene.count, set(sceneindex,0); );
            	loadscene(get(sceneindex),null,merge,blend(0.7));"/>

	<layer name="autotourOn" url="images/autotouron.png"  align="rightbottom" x="350" y="90" keep="true" zorder="-1" onhover="if(autotour.enabled, showtext(Visite Manuelle, info-bulle), showtext(Visite Automatique, info-bulle));" onclick="switch(autotour.enabled);"/>

This code will add a button into the panoramic view with an icon.

By default the AUTOTOUR is ON.

By clicking on the button you will swith from AUTOTOUR = ON to AUTOTOUR = OFF ...

The tooltips is link to the AUTOTOUR state. ;-)

5

Montag, 3. November 2014, 09:08

Hi, Kealkeal
can you send me your entire XML file

6

Montag, 3. November 2014, 11:53

Hi PanLUX,

My problem is solve now. *smile*

I've update my previous Post :

Quellcode

1
2
3
4
5
6
7
8
<!-- Mise en place Swicth Automatique des Scènes -->
	<events name="autotour"  keep="true" play="true" enabled="true"
    	autotour="
            	add(sceneindex,scene[get(xml.scene)].index,1);
            	if(sceneindex == scene.count, set(sceneindex,0); );
            	loadscene(get(sceneindex),null,merge,blend(0.7));"/>

	<layer name="autotourOn" url="images/autotouron.png"  align="rightbottom" x="350" y="90" keep="true" zorder="-1" onhover="if(autotour.enabled, showtext(Visite Manuelle, info-bulle), showtext(Visite Automatique, info-bulle));" onclick="switch(autotour.enabled);"/>

;-)