Tool Tips for animated hotspot

  • Using the tool tips example I was able to get tool tips to work with both flash and html5.
    I am not trying to get the tool tips to work with an animated hotspot.

    I used example krpano code for the animated hotspot:


    <style name="hotspot_ani_white"
    url="%SWFPATH%/hotspots/hotspot_ani_white_64x64x20.png"
    crop="0|0|64|64"
    framewidth="64" frameheight="64" frame="0" lastframe="19"
    onloaded="hotspot_animate();"

    />

    <!-- hotspot animation action -->
    <action name="hotspot_animate">
    inc(frame,1,get(lastframe),0);
    mul(ypos,frame,frameheight);
    txtadd(crop,'0|',get(ypos),'|',get(framewidth),'|',get(frameheight));
    delayedcall(0.03, if(loaded, hotspot_animate() ) );
    </action>


    Because both the animation for the hotspot and the tooltip are defined as "styles" I can't seem to get both of them to work together.

    Here is the tooltip snippit from the krpano examples that I am using:


    <!-- the 'tooltip' style - show tooltip textfield and update positions as long as hovering -->
    <style name="tooltip"
    onover="copy(layer[tooltip].html, tooltip);
    set(layer[tooltip].visible, true);
    tween(layer[tooltip].alpha, 1.0, 0.5);
    asyncloop(hovering, copy(layer[tooltip].x,mouse.stagex); copy(layer[tooltip].y,mouse.stagey); );"
    onout="tween(layer[tooltip].alpha, 0.0, 0.25, default, set(layer[tooltip].visible,false), copy(layer[tooltip].x,mouse.stagex); copy(layer[tooltip].y,mouse.stagey); );"
    />

    <!-- the 'tooltip' textfield -->
    <layer name="tooltip" keep="true"
    url="%SWFPATH%/plugins/textfield.swf"
    parent="STAGE"
    visible="false" alpha="0"
    enabled="false"
    align="lefttop"
    edge="bottom"
    oy="-2"
    width="200"
    autoheight="true"
    background="false" backgroundcolor="0xFFFFFF" backgroundalpha="1.0"
    border="false" bordercolor="0x000000" borderalpha="1.0"
    borderwidth="1.0" roundedge="0"
    shadow="0.0" shadowrange="4.0" shadowangle="45" shadowcolor="0x000000" shadowalpha="1.0"
    textshadow="1" textshadowrange="6.0" textshadowangle="90" textshadowcolor="0x000000" textshadowalpha="1.0"
    css="text-align:center; color:#FFFFFF; font-family:Arial; font-weight:bold; font-size:14px;"
    html=""
    />


    I tried something like this but the tooltip stayed on the screen after the onclick was executed.

    <hotspot name="spot1" style="hotspot_ani_white|tooltip" ath="271" atv="1" onclick="loadpano(tfn-complab-library.xml, null, MERGE(1));" "tooltip="here is some help"/>


    Any help or other options to help get tooltips to work with my animated hotspot would be greatly appreciated.

  • Hi,

    as explanation therefore:

    • the tooltip will be hidden in the 'onout' event
    • the 'onout' will be called when the mouse moves 'out' of the given element
    • but when loading a new pano, the hotspot will be directly removed and so there was no 'move out' and so also no 'onout' event - and therefore the tooltip will be not hidden


    That means the tooltip would need to be manually hidden in this case.

    e.g. first create an action for hiding the tooltip:

    Code
    <action name="hidetooltip">  set(layer[tooltip].alpha, 0.0);  set(layer[tooltip].visible,false);</action>

    and then either add that call to every hotspot where a new pano will be loaded - e.g.

    Code
    ... onclick="hidetooltip(); loadpano(...);"

    or use events to do that automatically - e.g.

    Code
    <events name="autotooltiphidder" keep="true" 
      	onxmlcomplete="hidetooltip();"
      	onremovepano="hidetooltip();"
      	/>

    Best regards,
    Klaus

  • I use this code for open and close map...

    When the map is open - tooltip disappears. But if you remove the mouse from the opened map and return it back, there is a tooltip for a second and then disappears. HTML5. How to fix this?

    Edited 2 times, last by omegas (February 23, 2014 at 6:30 PM).

  • Also i use this code

    Code
    <plugin name="scene_ef01" style="skin_tooltips" url="ef_map_point.png" keep="true" 
    parent="map" align="lefttop" edge="center" x="350"  y="661" zorder="2" 
    onclick="loadscene(scene_ef01, null, MERGE, BLEND(1));" 
    tooltip="get(scene[scene_ef01].title);" 
    onhover="trace(get(scene[scene_ef01].title));"  />

    And tooltip on mouse hover show: "get(scene.title);"
    But trace show correct: "Tooltip text"

    Where is my mistake?

    Edited 5 times, last by omegas (February 20, 2014 at 5:10 PM).

  • Not sure about what exactly you want to achieve but I think there are some inconsistencies in your code:
    - You obviously have scene with the name: scene_ef01 In this scene you have title defined title="Tooltip text"

    Why you have this line?
    tooltip="get(scene[scene_ef01].title);"
    Why setting tooltip attribute on plugin of the same name as scene when you already have text stored in scene title?
    For first question don't see your hidetooltips action to give you more info.

  • I use this code (plugin) for hotpoints on simple map navigation (my own map, not google or bing). So i need tooltips for this points from scene title... With showtext() it`s work perfect... But in 1.17 showtext() not so cool... :)

  • I solve my problem this way

    Code
    <plugin name="scene_ef02" style="skin_tooltips" url="ef_map_point.png"
    keep="true" parent="map" align="lefttop" edge="center" x="787"
     y="606" zorder="2" onclick="loadscene(scene_ef02, null, MERGE, BLEND(1));"
    onloaded="copy(tooltip,scene[scene_ef02].title)" />

    Use copy in onloaded

    But i don`t understand why my first version doesn`t work...


    Soo.... My be anybody know how to solve my first problem with map?


  • Hi,

    the 'skin_tooltips' <style> from the latest vtourskin.xml works by using the onover/onout mouse events to show or hide the tooltip text element.

    In some cases, e.g. when an element will get removed, there can be 'onout' event anymore, because the element itself will be not there anymore.

    For such cases there is the predefined 'skin_hidetooltips' action in the vtourskin.xml, it will manually hide the tooltips text element.

    That means add a call to that action where something will change to make sure that the tooltip will be removed.

    Best regards,
    Klaus

  • For such cases there is the predefined 'skin_hidetooltips' action in the vtourskin.xml, it will manually hide the tooltips text element.

    That means add a call to that action where something will change to make sure that the tooltip will be removed.

    Yep, i use it, but it`s doesnt help... Look into my code.
    When i remove the mouse from the opened map and return it back, there is a tooltip for a second and then disappears.

  • It`s standart code from exampels with map navigation (without radar)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!