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 :


    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*

  • You can try something like this:

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

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

  • Ok here is the solution doing by my own :

    Code
    <!-- 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. *wink*

  • Hi PanLUX,

    My problem is solve now. *smile*

    I've update my previous Post :

    Code
    <!-- 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);"/>


    *wink*

Jetzt mitmachen!

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