|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
<plugin name="test" url="" align="center" />
<action name="showtest">
<!-- hide the image at begin -->
set(plugin[test].visible, false);
<!-- set the onloaded event to show the image when loaded -->
set(plugin[test].onloaded, openimage);
<!-- set a new url and start loading the image -->
set(plugin[test].url, image.png);
</action>
<action name="openimage">
<!-- save the original size of the image -->
copy(plugin[test].fullwidth, plugin[test].width);
copy(plugin[test].fullheight, plugin[test].height);
<!-- set the startup size -->
set(plugin[test].width,100);
set(plugin[test].height,50);
<!-- show the image -->
set(plugin[test].visible, true);
<!-- first tween the width to the screen width -->
tween(plugin[test].width, get(stagewidth), 1.0, default,
<!-- then calc the upscaled proportional height -->
div(temp, plugin[test].fullheight, plugin[test].fullwidth);
mul(temp, stagewidth);
<!-- then tween the height to that size -->
tween(plugin[test].height, get(temp), 1.0, default,
<!-- finally change the plugin sizes to percent and prop to keep the size also during window resizing -->
set(plugin[test].width,100%);
set(plugin[test].height,prop);
);
);
</action>
|
Hi Klaus,<!-- first tween the width to the screen width -->
tween(plugin[test].width, get(stagewidth), 1.0, default,
<!-- then calc the upscaled proportional height -->
div(temp, plugin[test].fullheight, plugin[test].fullwidth);
mul(temp, stagewidth);
<!-- then tween the height to that size -->
tween(plugin[test].height, get(temp), 1.0, default,
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
<action name="openImage">
tween(view.fov, 120,0.7);
tween(plugin[engine_hoist].width,1075,0.5); wait(1);
tween(plugin[engine_hoist].height,717,0.5);
tween(plugin[text2].scale, 0.56,0.2);
tween(plugin[text2].scale, 0.52,0.05);
tween(plugin[text2].scale, 0.55,0.1);
loadscene('scene_2',null,KEEPALL,BLEND(1.2));
</action>
<action name="closeWait">tween(plugin[wait].alpha,0,1); tween(plugin[wait].visible, 0);stopLoader();</action>
<action name="stopLoader">set("progress.showload","none");
set("progress.showwait","none");</action>
<action name="hotspot_animate">inc(frame,1,get(frames),0);
mul(ypos,frame,frameheight);
txtadd(crop,'0|',get(ypos),'|',get(framewidth),'|',get(frameheight));
delayedcall(0.02,hotspot_animate());</action>
<action name="showImage">set(plugin[photo].url, %1);
set(plugin[text].url, %2);
tween(view.fov, 120,0.7);
tween(plugin[photo].width,get(stagewidth),0.5);
set(plugin[photo].width,prop);
tween(plugin[photo].height,get(stageheight),0.5);
set(plugin[photo].height,70%);
tween(plugin[text].scale, 0.56,0.2);
tween(plugin[text].scale, 0.52,0.05);
tween(plugin[text].scale, 0.55,0.1);
loadscene('scene_2',null,KEEPALL,BLEND(1.2));</action>
<action name="close">tween(plugin[text].scale, 0,0.3);
tween(plugin[photo].height, 100,0.2,easyIn);
tween(plugin[photo].width, 0,0.3,easyIn, pano());</action>
<action name="close_text">tween(plugin[text].scale, 0,0.3);</action>
<action name="close2">tween(plugin[text2].scale, 0,0.3);
tween(plugin[engine_hoist].height, 100,0.2,easyIn);
tween(plugin[engine_hoist].width, 0,0.3,easyIn, pano());</action>
<action name="close_text2">tween(plugin[text2].scale, 0,0.3);</action>
<action name="pano">loadscene('scene_yomec',null,KEEPALL,BLEND(1.2), zoom());</action>
|
)This post has been edited 3 times, last edit by "Jarredja" (Mar 15th 2011, 6:37pm)
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
<!--- Replace your URL -->
<plugin name="test" url="%SWFPATH%/graphics/engine_hoist.png" visible="false" keep="true" align="center" />
<!--- Rename your action, plugin names and onclick functions-->
<action name="showimage2">
set(plugin[test].zorder, 3);
push(plugin[test].width);
push(plugin[test].height);
plugin[test].resetsize();
copy(plugin[test].originalwidth, plugin[test].width);
copy(plugin[test].originalheight, plugin[test].height);
pop(plugin[test].height);
pop(plugin[test].width);
set(plugin[test].width,100);
set(plugin[test].height,50);
set(plugin[test].visible, true);
set(imgwidth, get(plugin[test].originalwidth));
set(imgheight, get(plugin[test].originalheight));
set(maxw, get(stagewidth));
mul(maxwidth, maxw, 0.6);
set(maxh, get(stageheight));
mul(maxheight, maxh, 0.6);
if(imgwidth GT maxwidth,
mul(imgheight, imgheight, maxwidth);
div(imgheight, imgheight, imgwidth);
copy(imgwidth, maxwidth);
set(plugin[test].imgheight, prop);
);
if(imgheight GT maxheight,
mul(imgwidth, imgwidth, maxheight);
div(imgwidth, imgwidth, imgheight);
copy(imgheight, maxheight);
set(plugin[test].imgwidth, prop);
);
tween(plugin[test].width, get(imgwidth),2.0);
wait(2);
tween(plugin[test].height, get(imgheight),2.0);
set(plugin[test].onclick, close2() );
</action>
|
Thanks again.
Quoted
<hotspot name="spot1" style="info_spot" ath="14.13" atv="6.45" onhover="showtext(Clique para más información, buttonstyle);"
onclick="lookto(14,0,65,smooth(150,30,40)); picurl(plugins/art/pic1.png)" />
<hotspot name="spot2" style="info_spot" ath="32.25" atv="6.50" onhover="showtext(Clique para más información, buttonstyle);"
onclick="lookto(32,0,65,smooth(150,30,40));picurl(plugins/art/pic2.png)" />
<hotspot name="spot3" style="info_spot" ath="136" atv="11" onhover="showtext(Clique para más información, buttonstyle);"
onclick="lookto(136,0,65,smooth(150,30,40));picurl(plugins/art/pic3.png)" />
<hotspot name="spot4" style="info_spot" ath="213" atv="11" onhover="showtext(Clique para más información, buttonstyle);"
onclick="lookto(213,0,65,smooth(150,30,40));picurl(plugins/art/pic4.png)" />
<hotspot name="spot5" style="info_spot_2" ath="-72" atv="7.6" onhover="showtext(Clique para más información, buttonstyle);"
onclick="lookto(-72,0,65,smooth(150,30,40));picurl(plugins/art/pic5.png)" />
<plugin name="image" url=""
visible="false" keep="true" align="center" zorder="3" />
<action name="picurl">
set(plugin[image].url,%1);
showImage();
</action>
<action name="showImage">
push(plugin[image].width);
push(plugin[image].height);
plugin[image].resetsize();
copy(plugin[image].originalwidth, plugin[image].width);
copy(plugin[image].originalheight, plugin[image].height);
pop(plugin[image].height);
pop(plugin[image].width);
set(plugin[image].width,100);
set(plugin[image].height,50);
set(plugin[image].visible, true);
set(imgwidth, get(plugin[image].originalwidth));
set(imgheight, get(plugin[image].originalheight));
set(maxw, get(stagewidth));
mul(maxwidth, maxw, 0.8);
set(maxh, get(stageheight));
mul(maxheight, maxh, 0.8);
if(imgwidth GT maxwidth,
mul(imgheight, imgheight, maxwidth);
div(imgheight, imgheight, imgwidth);
copy(imgwidth, maxwidth);
set(plugin[image].imgheight, prop);
);
if(imgheight GT maxheight,
mul(imgwidth, imgwidth, maxheight);
div(imgwidth, imgwidth, imgheight);
copy(imgheight, maxheight);
set(plugin[image].imgwidth, prop);
);
tween(plugin[image].width, get(imgwidth),0.3,,
tween(plugin[image].height, get(imgheight),0.6));
set(plugin[image].onclick, close() );
</action>
This post has been edited 1 times, last edit by "Kev-in-spain" (Mar 16th 2011, 5:14pm)
|
|
Source code |
1 2 3 4 |
<hotspot name="spot1" url="%SWFPATH%/img/1.png" ath="-20" atv="-15" visible="true" urltxt="%SWFPATH%/plugins/art/pic1.png" onclick="looktohotspot(spot1,65,smooth(100,50,20)); showimage2(t1);" /> <hotspot name="spot2" url="%SWFPATH%/img/2.png" ath="-20" atv="15" visible="true" urltxt="%SWFPATH%/plugins/art/pic2.png" onclick="looktohotspot(spot2,65,smooth(100,50,20)); showimage2(t2);" /> ........ |
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
<action name="showimage2">
addplugin(%1);
set(plugin[%1].url, get(hotspot[spo%1].urltxt ));
set(plugin[%1].keep, true);
set(plugin[%1].visible, false);
set(plugin[%1].align, center);
set(plugin[%1].zorder, 3);
wait(1);
copy(plugin[%1].originalwidth, plugin[%1].width);
copy(plugin[%1].originalheight, plugin[%1].height);
set(plugin[%1].width,100);
set(plugin[%1].height,50);
set(plugin[%1].visible, true);
set(imgwidth, get(plugin[%1].originalwidth));
set(imgheight, get(plugin[%1].originalheight));
set(maxw, get(stagewidth));
mul(maxwidth, maxw, 0.9);
set(maxh, get(stageheight));
mul(maxheight, maxh, 0.9);
if(imgwidth GT maxwidth,
mul(imgheight, imgheight, maxwidth);
div(imgheight, imgheight, imgwidth);
copy(imgwidth, maxwidth);
set(plugin[%1].imgheight, prop);
);
if(imgheight GT maxheight,
mul(imgwidth, imgwidth, maxheight);
div(imgwidth, imgwidth, imgheight);
copy(imgheight, maxheight);
set(plugin[%1].imgwidth, prop);
);
tween(plugin[%1].width, get(imgwidth),1.50);
wait(2);
tween(plugin[%1].height, get(imgheight),1.50);
set(plugin[%1].onclick, close2(%1) );
</action>
<action name="close2">
tween(plugin[%1].height, 10, 1.5, ,wait);
tween(plugin[%1].width, 10, 1.5, ,wait);
zoomto(90,smooth()); set(plugin[%1].visible, false);
removeplugin(%1);</action>
|
This post has been edited 3 times, last edit by "Jarredja" (Oct 31st 2011, 3:23am)
The code works perfectly but the only remaining issue was that the images all load as the tour loads.
Quoted
<action name="showImage">
set(plugin[%1].zorder, 3);
push(plugin[%1].width);
push(plugin[%1].height);
plugin[%1].resetsize();
copy(plugin[%1].originalwidth, plugin[%1].width);
copy(plugin[%1].originalheight, plugin[%1].height);
pop(plugin[%1].height);
pop(plugin[%1].width);
set(plugin[%1].width,100);
set(plugin[%1].height,50);
set(plugin[%1].visible, true);
set(imgwidth, get(plugin[%1].originalwidth));
set(imgheight, get(plugin[%1].originalheight));
set(maxw, get(stagewidth));
mul(maxwidth, maxw, 0.8);
set(maxh, get(stageheight));
mul(maxheight, maxh, 0.8);
if(imgwidth GT maxwidth,
mul(imgheight, imgheight, maxwidth);
div(imgheight, imgheight, imgwidth);
copy(imgwidth, maxwidth);
set(plugin[%1].imgheight, prop);
);
if(imgheight GT maxheight,
mul(imgwidth, imgwidth, maxheight);
div(imgwidth, imgwidth, imgheight);
copy(imgheight, maxheight);
set(plugin[%1].imgwidth, prop);
);
tween(plugin[%1].width, get(imgwidth),0.3,,
tween(plugin[%1].height, get(imgheight),0.6));
set(plugin[%1].onclick, close(%1) );
</action>
I know this is a long and quite complex post but, I think (and, obviously, so does Jarred judging by the amount of input he has had) that it will be worth it to get this sorted out.
Quoted
Original plugin:
<plugin name="image1" url=""
visible="false" keep="true" align="center" />
Plugin at point of 'stuckness'taken from the editor:
<plugin name="image1"
url="plugins/art/pic1.png"
keep="true" preload="false"
visible="true" enabled="true" handcursor="true" capture="true" children="true" usecontentsize="false"
zorder="3"
alpha="1.00" blendmode="normal" effect="" smoothing="true"
align="center" edge=""
x="" y="" ox="" oy=""
width="NaN" height="NaN"
crop="" ondowncrop="" onovercrop=""
scale="1" scale9grid="" scalechildren="false"
rotate="0"
parent=""
mask=""
onloaded=""
onover=""
onhover=""
onout=""
ondown=""
onup=""
onclick="close(image1)"
devices="all"
originalheight="NaN"
originalwidth="NaN" - what does 'NaN' mean?
/>
Plugin copy at 'stuck' point:
(I assume produced from:
copy(plugin[%1].originalwidth, plugin[%1].width);
copy(plugin[%1].originalheight, plugin[%1].height);
in the action code....? as it is not in the original xml and appears after a hotspot has been clicked)
<plugin name=""
url=""
keep="false" preload="false"
visible="true" enabled="true" handcursor="true" capture="true" children="true" usecontentsize="false"
zorder="3"
alpha="1.00" blendmode="normal" effect="" smoothing="true"
align="" edge=""
x="" y="" ox="" oy=""
width="NaN" height="NaN"
crop="" ondowncrop="" onovercrop=""
scale="1" scale9grid="" scalechildren="false"
rotate="0"
parent=""
mask=""
onloaded=""
onover=""
onhover=""
onout=""
ondown=""
onup=""
onclick="close(null)"
devices="all"
originalheight="NaN"
originalwidth="NaN"
/>
Plugin with action complete (image open):
<plugin name="image1"
url="plugins/art/pic1.png"
keep="true" preload="false"
visible="true" enabled="true" handcursor="true" capture="true" children="true" usecontentsize="false"
zorder="3"
alpha="1.00" blendmode="normal" effect="" smoothing="true"
align="center" edge=""
x="" y="" ox="" oy=""
width="543.485784919654" height="732.8000000000001"
crop="" ondowncrop="" onovercrop=""
scale="1" scale9grid="" scalechildren="false"
rotate="0"
parent=""
mask=""
onloaded=""
onover=""
onhover=""
onout=""
ondown=""
onup=""
onclick="close(image1)"
devices="all"
imgwidth="prop"
originalheight="809"
originalwidth="600"
/>
Plugin copy with action complete (image open):
<plugin name=""
url=""
keep="false" preload="false"
visible="true" enabled="true" handcursor="true" capture="true" children="true" usecontentsize="false"
zorder="3"
alpha="1.00" blendmode="normal" effect="" smoothing="true"
align="" edge=""
x="" y="" ox="" oy=""
width="NaN" height="732.8000000000001"
crop="" ondowncrop="" onovercrop=""
scale="1" scale9grid="" scalechildren="false"
rotate="0"
parent=""
mask=""
onloaded=""
onover=""
onhover=""
onout=""
ondown=""
onup=""
onclick="close(null)"
devices="all"
originalheight="NaN"
originalwidth="NaN"
/>
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
<krpano version="1.0.8" onstart="">
<preview type="grid(cube,16,16,512,0xCCCCCC,0xFFFFFF,0x999999);" details="16" />
<plugin name="image" url="" visible="false" align="center" zorder="3" keep="true" onclick="closeimage" />
<plugin name="loading" url="%SWFPATH%/plugins/textfield.swf"
width="100" height="24" align="center" visible="false"
html="[p]loading[/p]"
css="p{color:#000000; font-family:Arial; font-weight:bold; font-size:16; margin-left:5; margin-right:5; text-align:center; }"
backgroundcolor="0xFFFFFF" roundedge="5" shadow="1" borderwidth="0" glow="4" glowcolor="0xFFFFFF"
/>
<action name="showimage">
<!-- hide/reset the image at begin -->
set(plugin[image].visible, false);
set(plugin[image].url,);
<!-- pop up a loading alert in the wait of the onloaded events -->
set(plugin[loading].visible, true);
<!-- set the onloaded event to show the image when loaded -->
set(plugin[image].onloaded, openimage);
<!-- set a new url and start loading the image -->
set(plugin[image].url, %1);
</action>
<action name="openimage">
set(plugin[loading].visible, false);
plugin[image].resetsize();
copy(plugin[image].originalwidth, plugin[image].width);
copy(plugin[image].originalheight, plugin[image].height);
set(plugin[image].width,20);
set(plugin[image].height,20);
set(plugin[image].visible, true);
set(imgwidth, get(plugin[image].originalwidth));
set(imgheight, get(plugin[image].originalheight));
set(maxw, get(stagewidth));
mul(maxwidth, maxw, 0.8);
set(maxh, get(stageheight));
mul(maxheight, maxh, 0.8);
if(imgwidth GT maxwidth,
mul(imgheight, imgheight, maxwidth);
div(imgheight, imgheight, imgwidth);
copy(imgwidth, maxwidth);
);
if(imgheight GT maxheight,
mul(imgwidth, imgwidth, maxheight);
div(imgwidth, imgwidth, imgheight);
copy(imgheight, maxheight);
);
tween(plugin[image].width, get(imgwidth),0.3,,WAIT);
tween(plugin[image].height, get(imgheight),0.6,,WAIT);
doimagepercent();
</action>
<action name="doimagepercent">
<!-- SELECT HOW YOU PREFER TO SET %/prop -->
<!-- set width = % and height = prop ---
div(temp,plugin[image].width,stagewidth);
mul(temp,temp,100);
txtadd(plugin[image].width,get(temp),%);
set(plugin[image].height, 'prop'); -->
<!-- OR set height = % and width = prop -->
div(temp,plugin[image].height,stageheight);
mul(temp,temp,100);
txtadd(plugin[image].height,get(temp),%);
set(plugin[image].width, 'prop');
</action>
<action name="closeimage">
<!-- Note: plugin[].pixelwidth/pixelheight only exist since
2011-02-23 - krpano 1.0.8.14 viewer pre-release -->
set(plugin[image].width,get(plugin[image].pixelwidth));
set(plugin[image].height,get(plugin[image].pixelheight));
tween(plugin[image].height, 20, 0.6, ,WAIT);
tween(plugin[image].width, 20, 0.3, ,WAIT);
set(plugin[image].visible, false);
set(plugin[image].url,);
</action>
<style name="buttonstyle"
url="%SWFPATH%/plugins/textfield.swf" children="false"
width="22" height="22"
css="p{color:#000000; font-family:Arial; font-weight:bold; font-size:14; margin-left:5; margin-right:5; text-align:center; }"
backgroundcolor="0xAAFFAA" roundedge="5" shadow="1" borderwidth="0" glow="4" glowcolor="0xFFFFFF"
visible="false"
onover="tween(alpha,0.7,distance(0.3,0.2));"
onout="tween(alpha,1.0,distance(0.3,0.2));"
onloaded="set(alpha,0);set(textblur,15);set(blur,15); set(visible,true); tween(alpha,1,0.3); tween(textblur,0,0.3); tween(blur,0,0.3);"
/>
<hotspot name="info1" style="buttonstyle"
html="[p]1[/p]"
ath="-45"
onclick="if(plugin[image].visible,closeimage());
lookto(get(ath),get(atv));
showimage(images/IMG_1683.jpg)"
/>
<hotspot name="info2" style="buttonstyle"
html="[p]2[/p]"
ath="-15"
onclick="if(plugin[image].visible,closeimage());
lookto(get(ath),get(atv));
showimage(images/IMG_1685.jpg)"
/>
<hotspot name="info3" style="buttonstyle"
html="[p]3[/p]"
ath="15"
onclick="if(plugin[image].visible,closeimage());
lookto(get(ath),get(atv));
showimage(../crop/crop-example-buttons.png)"
/>
<hotspot name="info4" style="buttonstyle"
html="[p]4[/p]"
ath="45"
onclick="if(plugin[image].visible,closeimage());
lookto(get(ath),get(atv));
showimage(../events/pano.jpg)"
/>
<hotspot name="info5" style="buttonstyle"
html="[p]5[/p]"
ath="75" atv="-5"
onclick="if(plugin[image].visible,closeimage());
looktohotspot(get(name),get(view.fov));
showimage(../compass/compass.png)"
/>
<hotspot name="info6" style="buttonstyle"
html="[p]6[/p]"
ath="0" atv="20"
onclick="if(plugin[image].visible,closeimage());
looktohotspot(get(name),get(view.fov));
showimage(../masks/heartglasses.jpg)"
/>
</krpano>
|
NaN (Not a Number) http://en.wikipedia.org/wiki/NaN
Quoted
originalwidth="NaN" - what does 'NaN' mean?
Quoted
Changes made to the following:
if(imgheight GT maxheight,
mul(imgwidth, imgwidth, maxheight);
div(imgwidth, imgwidth, imgheight);
copy(imgheight, maxheight);
);
tween(plugin[image].width, get(imgwidth),0.3,,
tween(plugin[image].height, get(imgheight),0.6,,));
doimagepercent();
</action>
&
<action name="closeimage">
tween(plugin[image].height, 100,0.6,,
tween(plugin[image].width, 0,0.3,,
tween(view.fov, 90,0.7,,
set(plugin[image].url,);
rotOn()))); (rotOn is my action to enable autorotation,as it is set to disable on hotspot click, and swap the rotation On/Off button)
</action>
Originally was:
if(imgheight GT maxheight,
mul(imgwidth, imgwidth, maxheight);
div(imgwidth, imgwidth, imgheight);
copy(imgheight, maxheight);
);
tween(plugin[image].width, get(imgwidth),0.3,,WAIT);
tween(plugin[image].height, get(imgheight),0.6,,WAIT);
doimagepercent();
</action>
&
<action name="closeimage">
<!-- Note: plugin[].pixelwidth/pixelheight only exist since
2011-02-23 - krpano 1.0.8.14 viewer pre-release -->
set(plugin[image].width,get(plugin[image].pixelwidth));
set(plugin[image].height,get(plugin[image].pixelheight));
tween(plugin[image].height, 20, 0.6, ,WAIT);
tween(plugin[image].width, 20, 0.3, ,WAIT);
set(plugin[image].visible, false);
set(plugin[image].url,);
</action>
This post has been edited 1 times, last edit by "Kev-in-spain" (Mar 21st 2011, 2:34pm)
That's normal if you do not use the correct Krpano.swf version as I had noted in my post:The only thing I didn't like was that, even though there was a tween command in the close action, the image dissapeared on click.
If you do not use the correct Krpano.swf version, the closeimage() action does not work correctly because of the pixelwidth/pixelheight variables that returns null...Also, you MUST use the krpano.swf version from 2011-02-23 - krpano 1.0.8.14 viewer pre-release
.....
....
<action name="closeimage">
<!-- Note: plugin[].pixelwidth/pixelheight only exist since
2011-02-23 - krpano 1.0.8.14 viewer pre-release -->
set(plugin[image].width,get(plugin[image].pixelwidth));
set(plugin[image].height,get(plugin[image].pixelheight));
tween(plugin[image].height, 20, 0.6, ,WAIT);
tween(plugin[image].width, 20, 0.3, ,WAIT);
set(plugin[image].visible, false);
set(plugin[image].url,);
</action>
....
If it works exactly how you want it, then you can erase the call to the doimagepercent() action and the action itself as they have no effect in the way you use them on your code... As you can notice, despite the call to the function, the plugin[image] does not resize onresize event !!!I made a couple of minor changes (below) and everything is now exactly how I want it.![]()
Hi Michel,If you do not use the correct Krpano.swf version, the closeimage() action does not work correctly because of the pixelwidth/pixelheight variables that returns null...
So thank you for thatMichel, just FYI.
. I appreciate your feedback as it makes things go forward, isn't it
?Well, there is someset(plugin[image].url,);
I have removed it and have not seen any adverse reaction.
...
...
...|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
<krpano version="1.0.8" onstart="">
<preview type="grid(cube,16,16,512,0xCCCCCC,0xFFFFFF,0x999999);" details="16" />
<plugin name="image" url="white.jpg" visible="false" align="center" zorder="3" keep="true" onclick="closeimage" />
<plugin name="loading" url="%SWFPATH%/plugins/textfield.swf"
width="100" height="24" align="center" visible="false"
html="[p]loading[/p]"
css="p{color:#000000; font-family:Arial; font-weight:bold; font-size:16; margin-left:5; margin-right:5; text-align:center; }"
backgroundcolor="0xFFFFFF" roundedge="5" shadow="1" borderwidth="0" glow="4" glowcolor="0xFFFFFF"
/>
<action name="showimage">
<!-- hide/reset the image at begin -->
set(plugin[image].visible, false);
<!-- pop up a loading alert in the wait of the onloaded events -->
set(plugin[loading].visible, true);
<!-- set the onloaded event to show the image when loaded -->
set(plugin[image].onloaded, openimage);
<!-- set a new url and start loading the image -->
set(plugin[image].url, %1);
</action>
<action name="openimage">
set(plugin[loading].visible, false);
plugin[image].resetsize();
copy(plugin[image].originalwidth, plugin[image].width);
copy(plugin[image].originalheight, plugin[image].height);
set(plugin[image].width,20);
set(plugin[image].height,20);
set(plugin[image].visible, true);
set(imgwidth, get(plugin[image].originalwidth));
set(imgheight, get(plugin[image].originalheight));
set(maxw, get(stagewidth));
mul(maxwidth, maxw, 0.8);
set(maxh, get(stageheight));
mul(maxheight, maxh, 0.8);
if(imgwidth GT maxwidth,
mul(imgheight, imgheight, maxwidth);
div(imgheight, imgheight, imgwidth);
copy(imgwidth, maxwidth);
);
if(imgheight GT maxheight,
mul(imgwidth, imgwidth, maxheight);
div(imgwidth, imgwidth, imgheight);
copy(imgheight, maxheight);
);
tween(plugin[image].width, get(imgwidth),0.3,,WAIT);
tween(plugin[image].height, get(imgheight),0.6,,WAIT);
doimagepercent();
</action>
<action name="doimagepercent">
<!-- SELECT HOW YOU PREFER TO SET %/prop -->
<!-- set width = % and height = prop - - -
div(temp,plugin[image].width,stagewidth);
mul(temp,temp,100);
txtadd(plugin[image].width,get(temp),%);
set(plugin[image].height, 'prop'); -->
<!-- OR set height = % and width = prop -->
div(temp,plugin[image].height,stageheight);
mul(temp,temp,100);
txtadd(plugin[image].height,get(temp),%);
set(plugin[image].width, 'prop');
</action>
<action name="closeimage">
<!-- Note: plugin[].pixelwidth/pixelheight only exist since
2011-02-23 - krpano 1.0.8.14 viewer pre-release -->
set(plugin[image].width,get(plugin[image].pixelwidth));
set(plugin[image].height,get(plugin[image].pixelheight));
tween(plugin[image].height, 20, 0.6, ,WAIT);
tween(plugin[image].width, 20, 0.3, ,WAIT);
set(plugin[image].visible, false);
set(plugin[image].onloaded, );
set(plugin[image].url,white.jpg);
</action>
<style name="buttonstyle"
url="%SWFPATH%/plugins/textfield.swf" children="false"
width="22" height="22"
css="p{color:#000000; font-family:Arial; font-weight:bold; font-size:14; margin-left:5; margin-right:5; text-align:center; }"
backgroundcolor="0xAAFFAA" roundedge="5" shadow="1" borderwidth="0" glow="4" glowcolor="0xFFFFFF"
visible="false"
onover="tween(alpha,0.7,distance(0.3,0.2));"
onout="tween(alpha,1.0,distance(0.3,0.2));"
onloaded="set(alpha,0);set(textblur,15);set(blur,15); set(visible,true); tween(alpha,1,0.3); tween(textblur,0,0.3); tween(blur,0,0.3);"
/>
<hotspot name="info1" style="buttonstyle"
html="[p]1[/p]"
ath="-45"
onclick="if(plugin[image].visible,closeimage());
lookto(get(ath),get(atv));
showimage(images/IMG_1683.jpg)"
/>
<hotspot name="info2" style="buttonstyle"
html="[p]2[/p]"
ath="-15"
onclick="if(plugin[image].visible,closeimage());
lookto(get(ath),get(atv));
showimage(images/IMG_1685.jpg)"
/>
<hotspot name="info3" style="buttonstyle"
html="[p]3[/p]"
ath="15"
onclick="if(plugin[image].visible,closeimage());
lookto(get(ath),get(atv));
showimage(../crop/crop-example-buttons.png)"
/>
<hotspot name="info4" style="buttonstyle"
html="[p]4[/p]"
ath="45"
onclick="if(plugin[image].visible,closeimage());
lookto(get(ath),get(atv));
showimage(../events/pano.jpg)"
/>
<hotspot name="info5" style="buttonstyle"
html="[p]5[/p]"
ath="75" atv="-5"
onclick="if(plugin[image].visible,closeimage());
looktohotspot(get(name),get(view.fov));
showimage(../compass/compass.png)"
/>
<hotspot name="info6" style="buttonstyle"
html="[p]6[/p]"
ath="0" atv="20"
onclick="if(plugin[image].visible,closeimage());
looktohotspot(get(name),get(view.fov));
showimage(../masks/heartglasses.jpg)"
/>
</krpano>
|
)Reinvent the wheel could be bad for production purpose, But it is a good exercice to understand how things work, do you not think so? I like those fishing expedition also
Quoted
and set out to reinvent the wheel. Even so, I have learned quite a bit from this fishing expedition.
...You are wellcome... Your color changing car is great... also your "cogwheel (Thanks again.
)" hotspot |
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
<krpano version="1.0.8" onstart="">
<preview type="grid(cube,16,16,512,0xCCCCCC,0xFFFFFF,0x999999);" details="16" />
<plugin name="loading" url="%SWFPATH%/plugins/textfield.swf"
width="100" height="24" align="center" visible="false"
html="[p]loading[/p]"
css="p{color:#000000; font-family:Arial; font-weight:bold; font-size:16; margin-left:5; margin-right:5; text-align:center; }"
backgroundcolor="0xFFFFFF" roundedge="5" shadow="1" borderwidth="0" glow="4" glowcolor="0xFFFFFF"
/>
<action name="showimage">
<!-- hide/reset the image at begin -->
if(plugin[image].loaded, removeplugin(image));
addplugin(image);
set(plugin[image].visible,false);
set(plugin[image].align,center);
set(plugin[image].zorder,3);
set(plugin[image].onclick, closeimage() );
trace('set(plugin[image].url,) = ',plugin[image].url);
<!-- pop up a loading alert in the wait of the onloaded events -->
set(plugin[loading].visible, true);
<!-- set the onloaded event to show the image when loaded -->
set(plugin[image].onloaded, openimage);
<!-- set a new url and start loading the image -->
set(plugin[image].url, %1);
</action>
<action name="openimage">
set(plugin[loading].visible, false);
plugin[image].resetsize();
copy(plugin[image].originalwidth, plugin[image].width);
copy(plugin[image].originalheight, plugin[image].height);
set(plugin[image].width,20);
set(plugin[image].height,20);
set(plugin[image].visible, true);
set(imgwidth, get(plugin[image].originalwidth));
set(imgheight, get(plugin[image].originalheight));
set(maxw, get(stagewidth));
mul(maxwidth, maxw, 0.8);
set(maxh, get(stageheight));
mul(maxheight, maxh, 0.8);
if(imgwidth GT maxwidth,
mul(imgheight, imgheight, maxwidth);
div(imgheight, imgheight, imgwidth);
copy(imgwidth, maxwidth);
);
if(imgheight GT maxheight,
mul(imgwidth, imgwidth, maxheight);
div(imgwidth, imgwidth, imgheight);
copy(imgheight, maxheight);
);
tween(plugin[image].width, get(imgwidth),0.3,,WAIT);
tween(plugin[image].height, get(imgheight),0.6,,WAIT);
doimagepercent();
</action>
<action name="doimagepercent">
<!-- SELECT HOW YOU PREFER TO SET %/prop -->
<!-- set width = % and height = prop - - -
div(temp,plugin[image].width,stagewidth);
mul(temp,temp,100);
txtadd(plugin[image].width,get(temp),%);
set(plugin[image].height, 'prop'); -->
<!-- OR set height = % and width = prop -->
div(temp,plugin[image].height,stageheight);
mul(temp,temp,100);
txtadd(plugin[image].height,get(temp),%);
set(plugin[image].width, 'prop');
</action>
<action name="closeimage">
<!-- Note: plugin[].pixelwidth/pixelheight only exist since
2011-02-23 - krpano 1.0.8.14 viewer pre-release -->
set(plugin[image].width,get(plugin[image].pixelwidth));
set(plugin[image].height,get(plugin[image].pixelheight));
tween(plugin[image].height, 20, 0.6, ,WAIT);
tween(plugin[image].width, 20, 0.3, ,WAIT);
set(plugin[image].visible, false);
removeplugin(image);
</action>
<style name="buttonstyle"
url="%SWFPATH%/plugins/textfield.swf" children="false"
width="22" height="22"
css="p{color:#000000; font-family:Arial; font-weight:bold; font-size:14; margin-left:5; margin-right:5; text-align:center; }"
backgroundcolor="0xAAFFAA" roundedge="5" shadow="1" borderwidth="0" glow="4" glowcolor="0xFFFFFF"
visible="false"
onover="tween(alpha,0.7,distance(0.3,0.2));"
onout="tween(alpha,1.0,distance(0.3,0.2));"
onloaded="set(alpha,0);set(textblur,15);set(blur,15); set(visible,true); tween(alpha,1,0.3); tween(textblur,0,0.3); tween(blur,0,0.3);"
/>
<hotspot name="info1" style="buttonstyle"
html="[p]1[/p]"
ath="-45"
onclick="if(plugin[image].visible,closeimage());
lookto(get(ath),get(atv));
showimage(images/IMG_1683.jpg)"
/>
<hotspot name="info2" style="buttonstyle"
html="[p]2[/p]"
ath="-15"
onclick="if(plugin[image].visible,closeimage());
lookto(get(ath),get(atv));
showimage(images/IMG_1685.jpg)"
/>
<hotspot name="info3" style="buttonstyle"
html="[p]3[/p]"
ath="15"
onclick="if(plugin[image].visible,closeimage());
lookto(get(ath),get(atv));
showimage(../crop/crop-example-buttons.png)"
/>
<hotspot name="info4" style="buttonstyle"
html="[p]4[/p]"
ath="45"
onclick="if(plugin[image].visible,closeimage());
lookto(get(ath),get(atv));
showimage(../events/pano.jpg)"
/>
<hotspot name="info5" style="buttonstyle"
html="[p]5[/p]"
ath="75" atv="-5"
onclick="if(plugin[image].visible,closeimage());
looktohotspot(get(name),get(view.fov));
showimage(../compass/compass.png)"
/>
<hotspot name="info6" style="buttonstyle"
html="[p]6[/p]"
ath="0" atv="20"
onclick="looktohotspot(get(name),get(view.fov));
showimage(../masks/heartglasses.jpg)"
/>
</krpano>
|
Thanks for the compliments.You are wellcome... Your color changing car is great... also your "cogwheel ()" hotspot
...