Hide hotspot with Scenename attribute...

  • hello there,
    i would like to know how i can hide hotspot with scene name attribute ?

    i'v add some hotspot dynamicly, and i've get the scene name and pluged it into the tag of these hotspot.
    ex:
    hs1 => get(xml.scene) => add these to TAG => scene1
    hs2 =>... scene1

    hs3 = scene2
    hs4 = scene2

    At the moments all these hotspot are visible on each scene...
    I would like to know how i can do to set visible only these witch have the same scene name ?

    if i'm on the scene 1 i only want to see these who have scene_name = scene1

    i have used get(xml.scene) to write the scene name onmy hotspot ...

    Code
    <action name="hidehotspots"> for(set(i,0), i LT hotspot.count, inc(i),  if(hotspot[get(i)].tag == get(xml.scene),  set(hotspot[get(i)].visible,false);   	);  </action>

    but i don't think it's a good way...

    regards

  • doesn't work at the moment but thx for the link...

    my code will be like this

    Code
    <action name="hidehotspots">		for(set(i,0), i LT hotspot.count, inc(i), 			if(hotspot[get(i)].tag !== xml.scene,     		set(hotspot[get(i)].visible,false); 		); 	</action>
  • the response is :

    null
    null
    null
    scene01 (yeah !!)

    then all the hotspot are listed and 3 of them doesn't have TAG: scene01
    Trace is ok for me :)

    i've test a trace(get(xml.scene)), and the result is scene01... then it's ok too...

    it's the condition that doesn't work

    " <action name="hidehotspots">
    for(set(i,0), i LT hotspot.count, inc(i),
    trace(get(hotspot[get(i)].tag)),
    if(hotspot[get(i)].tag !== xml.scene, <!-- i think i forget a ")" to close the condition ! but when i put it the trace doesnt work anymore -->
    set(hotspot[get(i)].visible, false);
    );
    </action>
    "


    ...

  • the response is :

    null
    null
    null
    scene01 (yeah !!)


    'null' can mean that the attribute 'tag' was not created for the 3 firt hotspots, so in the if() the condition is always considered as false, i will use the following code instead:

    Code
    <action name="hidehotspots">	for(set(i,0), i LT hotspot.count, inc(i), if(hotspot[get(i)].tag == xml.scene, set(hotspot[get(i)].visible,true); ,set(hotspot[get(i)].visible,false); 	); 	</action>
  • not work again :(

    i use .scale to test..


    <action name="hidehotspots">
    for(set(i,0), i LT hotspot.count, inc(i), trace(get(scene[get(xml.scene)].name)),
    if(hotspot[get(i)].tag === xml.scene, set(hotspot[get(i)].scale,10); ,
    set(hotspot[get(i)].scale,0);
    );
    </action>

    Then the "null" hotspot don't scale to 0 and the "scene01" don't scale to 10 :(
    Hotspot with tag are created dynamicly on the scene...

  • i've made some test:

    set all my hotspot tag="toto"

    and remove all plugins and other xml

    put these code into my tour.xml


    <layer name="deletehtsp_scene" keep="true" align="top" type="text" width="100" height="100" bgcolor="0xffff00" onover="hidehotspots();" />

    <action name="hidehotspots">
    for(set(i,0), i LT hotspot.count, inc(i), trace(get(hotspot[get(i)].tag)),
    if(hotspot[get(i)].tag === toto, set(hotspot[get(i)].scale,10); ,
    set(hotspot[get(i)].scale,0);
    );
    </action>

    when i'm over, the consol say :
    toto (left)
    toto (right)
    toto (spot1)
    toto (vr_cursor)

    Trace get hotspot Tag works well but nothing change...
    if i remove the condition by,

    <action name="hidehotspots"> for(set(i,0), i LT hotspot.count, inc(i), set(hotspot[get(i)].scale,10); ); </action>
    all my hotspot will be scale by 10.

    :/ strange...

  • Hi

    My editor shows me some problem with a brackets... *smile*

    it must work

    Code
    <action name="hidehotspots">
     trace(get(scene[get(xml.scene)].name));
     for(set(i,0), i LT hotspot.count, inc(i), 
      if(hotspot[get(i)].tag == xml.scene, 
       set(hotspot[get(i)].scale,10);
      ,
       set(hotspot[get(i)].scale,0);
      );	
     ); 
    </action>


    Piotr

  • <layer name="deletehtsp_scene" keep="true" align="top" type="text" width="100" height="100" bgcolor="0xffff00" onover="hidehotspots();" />

    <action name="helperaction">
    set(hotspot[get(i)].visible,false);
    </action>
    <action name="hidehotspots">
    for(set(i, 0), i LT plugin.count, inc(i),
    if(hotspot[get(i)].tag !== xml.scene,
    helperaction(get(i));
    );
    );
    </action>

    this work Too :)

    Thx for every things

  • Hi

    My editor shows me some problem with a brackets... *smile*

    it must work

    Code
    trace(get(scene[get(xml.scene)].name));
     for(set(i,0), i LT hotspot.count, inc(i), 
      if(hotspot[get(i)].tag == xml.scene, 
       set(hotspot[get(i)].scale,10);
      ,
       set(hotspot[get(i)].scale,0);
      );	
     );


    Piotr

    Owww !! thx can you tell me if i can put a second "condiction" ? like

    if(hotspot[get(i)].tag !== xml.scene, toto,

    then blah blah blah

    Cause it's hide all my other hotspot.

  • <action name="hidehotspots">
    trace(get(scene[get(xml.scene)].name));
    for(set(i,0), i LT hotspot.count, inc(i),
    trace(get(hotspot[get(i)].tag));
    if(hotspot[get(i)].tag == xml.scene,
    set(hotspot[get(i)].visible,true);
    ,
    set(hotspot[get(i)].visible,false);
    );
    if(hotspot[get(i)].tag == toto,
    set(hotspot[get(i)].visible,true);
    );
    );
    </action>


    Final Code !

    You can close this thread :D thx

Jetzt mitmachen!

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