How to display small thumbnail image with the onhover method?

  • Hi,

    I'm about to take on a task of creating a virtual tour to be presented on a CD/DVD. The tour loads with just one aerial 360 degree image and this will contain approx 25 hotspots to load other 360 degree images.I guess there will have to be a main 'HOME' button added so that people can get back to the main aerial 360.

    I've used hotspots before and also onhover=showtext to display the labels but on this occasion I would like to display a small thumbnail image with the onhover method. This way the viewer can see a brief preview and then clicking loads the 360 shot. I'll make 25 separate framed thumbnails for this.

    Could anyone please point me in the direction of getting the thumbnails to show please?


    Here's the code below that I will be using


    Many thanks,

    Andrew

  • That may not be 100% correct... but it hopefully will get you on the correct path.

    Your onhover will now show the text as well as call the show_hover_image action and passes two variables to that action. The show_hover_image action dynamically sets two parameters (parent and url in the plugin "hover_image") that were passed to it from the onhover call. The first one listed "hs0" is put in for %1 and "path/to/thum.jpg" is put in for %2.

    You will need to experiment with the align / edge / x / y and if needed ox and oy so that your hover_image shows in an agreeable location.

    This wasn't tested... but I've worked on something similar... so "in theory" it should work.

    Let us know.

  • Thanks for your reply Graydon and the sample code. It certainly looks the part but unfortunately I can't get it to work. Tried many different combination's but get the following error message

    Code
    WARNING: not local trusted - ExternalInterface disabled!
    ERROR: no parent "hs0" found

    Not sure if that is because I'm viewing the tour locally but that is how it will be presented from a CD so I'm out of luck if it is the cause.

    The thumbnail shows straight away though and stays there when the 360 shot loads and then when I mouse over the hotspot the 'text' appears and hides the thumbnail in the same process.


    Certainly one of those things that'll keep me scratching my head for a while *wink*

    Andrew

  • A plugin can be a child of a hotspot (had to search the forum to confirm)... but it looks like you can't use a multi-point hotspot as a parent.

    If you change the hs0 to a image hotspot with just an "ath" and "atv" then the child will show. Makes sense I guess since a multipoint hotspot may no longer have a easily defined "center" or edge to align to. An image hotspot will have set edges and such to align the child to.

    Another oversight on my part is that you don't want to use the onhover to drive your action for the "show_hover_image"... as onhover repeatedly calls the action.

    You will want to use the onover (no 'h') to turn on the thumb and the onout to hide it again... which adds a bit more complexity... but if you jot down the sequence of steps that you want to happen it will be easier to write up.

    onover:
    - set thumb image parent to current hotspot
    - set thumb image url
    - make thumb image visible

    onout:
    - make thumb image hidden

    Sorry to have led you astray some there.

  • Here's some tested code that is working...

    I'm just using random images that I have readily available in a test area... you'll obviously need to change them for your purposes.

    Instead of "hiding" the hover_image onout.... just set it's url to 'null' which seems to work.

  • Holy Chow!

    Thanks Graydon. Certainly appreciate the effort you put into getting this up and running. I had spent three hours yesterday afternoon on it an managed to get things going but the hover_image was flickering like crazy if it appeared over the hotspot marker plus I had to many actions. Not to worry though as your version is way better as there is just one action group and I can just adjust the onover="action(show_hover_image,hs1,thumbnails/sandringham.png);" for each hotspot I make.

    Excellent. *smile*

    I enjoyed trying to work it out but it's so time consuming when you don't have a good understanding of it.

    Thanks again,

    Andrew

  • there must be an issue setting a polygon hotspot as parent if you change the onhover to the polygon to hs0 it does show over the other image. it must not know where to land i tried adding an atv and ath value for the child to use and that did not work either.

  • Code
    <hotspot name="spot5555" style="skin_hotspotstyle2" ath="36.7" atv="13.6" distorted="false" zoom="false" linkedscene="scene_xuechang-bottom"/>
    <style name="skin_hotspotstyle2" url="tunnel.png" scale="1" edge="bottom" y="20" distorted="false"	scalechildren="true"	tooltip=""	linkedscene=""	linkedscene_lookat=""	onclick="skin_hotspotstyle_click();"	onover="tween(scale,1.02);tween(oy,-10)"	onout="tween(scale,1);tween(oy,0)"	onloaded="add_all_the_time_tooltip_bottom();get_the_thumb();"
    	/>		<action name="get_the_thumb">	txtadd(roundthumbname, 'roundthumb_', get(name));	addlayer(get(roundthumbname));	txtadd(layer[get(roundthumbname)].parent, 'hotspot[', get(name), ']');	txtreplace(roundthumburl,scene[get(linkedscene)].thumburl,'thumb.jpg','thumb1.png');	copy(layer[get(roundthumbname)].url, roundthumburl);
    	set(layer[get(roundthumbname)].align,center);	set(layer[get(roundthumbname)].edge,bottom);
    	set(layer[get(roundthumbname)].x,0);	set(layer[get(roundthumbname)].y,20);	set(layer[get(roundthumbname)].width,56);	set(layer[get(roundthumbname)].height,56);	set(layer[get(roundthumbname)].linkedscene,get(linkedscene));
    	set(layer[get(roundthumbname)].onclick,skin_hotspotstyle_click_roundthumb(); callwith(hotspot[get(name)],onclick););		</action><action name="skin_hotspotstyle_click_roundthumb">	       	       if(linkedscene,	       if(linkedscene_lookat,	       txtsplit(linkedscene_lookat, ',', hs_lookat_h, hs_lookat_v, hs_lookat_fov);	       );	       set(enabled, false);	       skin_hidetooltips();
    	       tween(depth|alpha|oy|rx|scale, 4000|0.8|0|-60|1.0, 0.5, default,	       skin_loadscene(get(linkedscene), get(skin_settings.loadscene_blend));	       if(hs_lookat_h !== null,	       skin_lookat(get(hs_lookat_h), get(hs_lookat_v), get(hs_lookat_fov));	       delete(hs_lookat_h, hs_lookat_v, hs_lookat_fov);	       );	       skin_updatescroll();	       );	       );	       </action>


    simple to understand and easy to use~[size=10] *smile*[size=10]

Participate now!

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