actionname(parameters);
variable name (read only) | type | default value | |
version | String | ||
---|---|---|---|
The krpano version string, e.g. "1.16". | |||
variable name (read only) | type | default value | |
xmlversion | String | ||
The version setting from the xml. When not set this will be the same number as the krpano version string. | |||
variable name (read only) | type | default value | |
build | String | ||
The krpano build string, e.g. "2013-03-28". | |||
variable names (read only) | type | default value | |
mouse.x mouse.y mouse.stagex mouse.stagey |
int int int int |
||
The current mouse position. The mouse.x and mouse.y coordinates are relative to the left top edge of the area and the mouse.stagex and mouse.stagey coordinates to the left top edge of the whole stage/window. |
|||
variable name (read only) | type | default value | |
keycode | int | 0 | |
The keycode of the last pressed or released key. It will be set in the onkeydown and onkeyup events. Note - here a small code snippet to find out the keycode of the pressed key: <events onkeydown="showlog(); trace('keycode=',keycode);" /> |
|||
variable name (read only) | type | default value | |
wheeldelta | int | 0 | |
The delta of the mouse wheel rotation. This variable will be set in the onmousewheel event. |
|||
variable name (read only) | type | default value | |
wheeldelta_raw | Number | Number.NaN | |
The 'raw' unscaled and non-rounded delta value of the mouse wheel rotation. The normal wheeldelta values are limited to integer values and can be too inaccurate for some usages (plugins). Note - in the krpano Flash viewer, the raw values are only available when using the default krpano embedding script and only in windowed-mode (not in Fullscreen mode)! In the krpano HTML5 viewer, the raw values are always available. |
|||
variable name | type | default value | |
fullscreen | Boolean | false | |
The fullscreen variable holds the current state of the fullscreen mode. When it will be changed, then also the fullscreen mode will change. Note - there is a Flashplayer security limitation - switching to fullscreen mode is only possible as reaction of an user input like a mouse click or a keypress! That means you can only switch to fullscreen mode in a onclick or onkeydown event. Example - switch to fullscreen mode: onclick="set(fullscreen,true);"Example - switch between fullscreen and windowed mode: onclick="switch(fullscreen);" Note - before using the fullscreen setting, it should be verified if the current browser/device actually supports the Fullscreen mode. This can be done with the xml fullscreensupport devices setting and the device.fullscreensupport variable. HTML5 Notes - when the HTML5 Fullscreen Mode is NOT supported by the browser, then the fullscreen setting will only change the size of the viewer html element to match the size of the full browser window. Due technical limitations this will not working from inside an <iframe> and can be problematic in nested html structures. |
|||
variable names (read only) | type | default value | |
stagewidth stageheight |
int int |
||
The size of the current window in pixels. Get the this size in the onresize event. |
|||
variable names (HTML5 only) | type | default value | |
stagescale | Number | 1.0 | |
A global overall scaling setting. The stagescale setting will scale all krpano elements and sizes. By scaling all elements, the krpano stage-size (screensize/resolution) itself will be scaled inversely by this value - e.g. a value of 0.5 will scale-down all elements by 50%, while increasing the internal stage-sizes by 200% at the same time. The default stagescale value depends on the device, the browser, the Javascript window.devicePixelRatio value and the viewport scaling. On desktop and many tablets the default value will be 1.0, on iPhone 0.5 and on many Android mobiles something between 0.5 and 0.75. |
|||
variable name (read only) | type | default value | |
browser.useragent | String | ||
The user-agent string of the browser. The same as navigator.userAgent in Javascript. Note - this string will be only available when using the default embedding script. |
|||
variable name (read only, html5 only) | type | default value | |
browser.platform | String | ||
The platform string of the browser. The same as navigator.platform in Javascript. |
|||
variable names (read only) | type | default value | |
device.flash device.flashversion device.html5 device.desktop device.mobile device.tablet device.css3d device.webgl device.fullscreensupport device.pixelratio device.touchdevice device.gesturedevice device.ios device.iosversion device.iphone device.ipod device.ipad device.retina device.android device.androidversion device.androidstock device.blackberry device.chrome device.chromeversion device.firefox device.firefoxversion device.ie device.ieversion device.safari device.safariversion device.opera device.operaversion device.air device.standalone device.windows device.mac device.linux |
Boolean Number Boolean Boolean Boolean Boolean Boolean Boolean Boolean Number Boolean Boolean Boolean Number Boolean Boolean Boolean Boolean Boolean Number Boolean Boolean Boolean Number Boolean Number Boolean Number Boolean Number Boolean Number Boolean Boolean Boolean Boolean Boolean |
false false false false false false false false 1.0 false false false false false false false false false false false false false false false false false false false false |
|
The device object provides information about the current device/system.
It's the dynamic/scripting equivalent to the xml devices attribute. The attributes/properties of the device object can be checked anytime by scripting code, e.g. by the if() action. The device object has these properties:
if(device.html5, ...); if(device.flash, ...); if(device.android, if(device.flash, ...); ); if(device.iOSversion GT 5.1, ...); |
|||
variable names (read only) | type | default value | |
isflash ishtml5 ismobile istablet isdesktop isphone ispad isandroid istouchdevice isgesturedevice iosversion |
Boolean Boolean Boolean Boolean Boolean Boolean Boolean Boolean Boolean Boolean String |
false false false false false false false false false false "0" |
|
Note - these variables are deprecated - use the new device object instead!
Global device detection variables.
|
|||
variable name (read only) | type | default value | |
timertick | int | ||
The timertick variable returns the number of milliseconds that have elapsed since the viewer was started (1000 milliseconds = 1 second). | |||
variable name (read only) | type | default value | |
random | Number | 0.0 - 1.0 | |
The random variable returns the a random number in range 0.0 to 1.0. Example - how to get a random value in the range 1 - 10: mul(val, random, 9); add(val, 1); roundval(val); trace('random value=',val); |
|||
variable names | type | default value | |
hlookat_moveforce vlookat_moveforce fov_moveforce |
Number Number Number |
0.0 0.0 0.0 |
|
These variables are defining a moving force to move the view / the pano. When set to a value other than 0.0 the view will start slowly accelerating (controlled by keybaccelerate) and move with a maximum speed (controlled by keybspeed) until set back to 0.0, then it will slow down (controlled by keybfriction). |
|||
variable name (read only) | type | default value | |
multireslevel | int | ||
The multireslevel variable returns the current multi-resolution level (0 - image.level.count). |
|||
variable name | type | default value | |
lockmultireslevel | String | -1 | |
Lock the automatic multi-resolution level selection to a fixed level. Set lockmultireslevel to "current" to lock the level to the current level. To release the level locking set lockmultireslevel back to "-1". |
|||
variable name | type | default value | |
downloadlockedlevel | Boolean | false | |
When set to true then the locked level will be downloaded completely. | |||
variable name (read only) | type | default value | |
xml.url | String | ||
The xml.url variable contains the path/url of the currently, via loadpano(), loaded xml file. The value will be set to empty-string ("") when loadscene() or loadxml() were used to load the pano. | |||
variable name (read only) | type | default value | |
xml.content | String | ||
The xml.content variable contains the whole content of the currently loaded xml file as string. | |||
variable name (read only) | type | default value | |
xml.scene | String | ||
The xml.scene variable contains the name of currently loaded scene. | |||
variable name (read only) | type | default value | |
lasterror | String | ||
The lasterror variable contains the last error message when an error had happened. To get this variable the onloaderror event must be used. | |||
variable name (read only) | type | default value | |
haveexternalinterface | Boolean | true | |
This variable can be used to check if the External Interface from the Flashplayer is available.
This interface is necessary for the Javascript Interface and for the
openurl actions. Online on a server the External Interface is always available, but locally only when Flash file will be opened inside the Browser and when the folder of the Flash swf is in a 'trusted folder'. The trusted folders can be managent in the Flashplayer security settings, see here for more detatils - Local / Offline Usage. |
|||
variable name (read only) | type | default value | |
havenetworkaccess | Boolean | true | |
This variable can be used to check if the Network Access is available in the Flashplayer.
This can be used to avoid errors when trying to use plugins like the Google Maps or Bing Maps locally, because these
plugins are trying to load data from the web and so need Network Access. Online on a server the Network Access is always available, but locally only when the folder of the Flash swf is in a 'trusted folder'. The trusted folders can be managent in the Flashplayer security settings, see here for more detatils - Local / Offline Usage. |
set(variable, value)
set(var1, 'hello');
set(var2, get(var1));
set(fullscreen, true);
set(layer[p1].visible, false);
set(hotspot[h1].scale, 2.5);
set(contextmenu.item[0].caption, 'hello item');
set(events.onxmlcomplete, null);
get(variable)
set(dstvar, get(srcvar));
looktohotspot(get(name));
lookto(get(h), get(v), get(f));
showtext(get(msg));
tween(var,get(dstval));
set(pic, spot1); set(hotspot[get(pic)].visible, false);
trace('xyz=', xyz, ' get(xyz)=', get(xyz));
txtadd(msg, 'fov=', get(view.fov));
copy(destination, source)
set(destination, get(source) )
copy(dstvar, srcvar);
copy(cur_hlookat, view.hlookat);
copy(layer[text].x, mouse.x); copy(layer[text].y, mouse.y);
delete(variable, ...)
set(tmp1, ...); set(tmp2, ...); ... do something ... delete(tmp1, tmp2);
if(condition, then-actions, else-actions*)
ifnot(condition, then-actions, else-actions*)
if(variable, ...);Test if this variable is true or 'not 0' or 'not null'.
if(var1 OPERATOR var2, ...);The var1 or var2 can be a variables or values. When var1 or var2 is a variable then the content of the variable will be used for comparison. Only when using a 'strict' comparison operator (=== or !==) then var1 and var2 must be variables (or null).
== | equal |
!= | not equal |
< or LT | lower than * |
> or GT | greater than * |
<= or LE | lower or equal than * |
>= or GE | greater or equal than * |
=== | strict equal (compare only existent variables) |
!== | strict not equal (compare only existent variables) |
if(fullscreen, fullscreensetup(), windowsetup() );
if(fullscreen, set(layer[controls].visible, false) );
if(%1 != next, set(i,0) );
if(i LT 10, loop(next) );
if(var === null, set(var,0));
if(hotspot[spot1] === null, trace(there is no spot1 hotspot));
if(varA GT 5, if(varA LT 10, trace('varA is between 5 and 10') ); );
set(result,true); ifnot(varA, set(result,false) ); ifnot(varB, set(result,false) ); ifnot(varC, set(result,false) ); if(result, trace('all vars are true') );
if(var1 GT var2, trace('condition is true'); lookto(100,20,50); , trace('condition is false'); lookto(0,0,100); );
delayedcall(delay, actions)
delayedcall(id, delay, actions)
delayedcall(5.0, hidelogo() );
delayedcall(10, looktohotspot(spot1);loadpano(pano2.xml); );
delayedcall(1, showtext('hello'); ); delayedcall(4, showtext('to the pano'); );
<action name="updatemousepos"> copy(layer[cursor].x, mouse.x); copy(layer[cursor].y, mouse.y); delayedcall(0.02, updatemousepos() ); </action>
stopdelayedcall(id)
<events name="introimage_events" onnewpano="delayedcall(introimage, 5.0, hide_introimage() );" onremovepano="stopdelayedcall(introimage);" />
for(startactions, condition, nextactions, loopactions)
asyncfor(startactions, condition, nextactions, loopactions)
for(set(i,0), i LT 10, inc(i), trace('i=',i) );.
for(set(i,0), i LT layer.count, inc(i), trace('layer[',i,'].name=',layer[get(i)].name); );
loop(condition, loopactions)
asyncloop(condition, loopactions, doneactions*)
ondown="asyncloop(pressed, layer[scrollarea].scrollby(+2,0) );"
onover="asyncloop(hovering, updatemousepos(), hideinfo() );"
asyncloop(true, framehandler() );
switch(variable)
switch(variable, value1, value2, ...)
switch(fullscreen);
switch(hotspot.visible);
switch(layer[button1].visible);
switch(layer[button1].alpha, 1.0, 0.5);
switch(layer[child].parent, button1, button2, button3);
switch(destpos, -100, 0, +100); tween(y,get(destpos));
push(variable)
pop(variable)
push(varA); push(varB); pop(varB2); pop(varA2);
stopall()
breakall()
events.dispatch(eventname)
<events name="events1" myevent="trace(events1...);" /> <events name="events2" myevent="trace(events2...);" /> ... events.dispatch(myevent);
add(variable, valueA, valueB*)
sub(variable, valueA, valueB*)
mul(variable, valueA, valueB*)
div(variable, valueA, valueB*)
mod(variable, valueA, valueB*)
pow(variable, valueA, valueB*)
set(val, 1); add(val, 1); trace('val should be 2: val=',val);
mul(doublewidth, width, 2.0);
mul(scale, 0.5);
div(result, vala, valb);
add(dst,rotate,360); tween(rotate,get(dst),5);
add(xpos, mouse.x, mouse_x_offset);
sub(destx, stagewidth, destwidth);
div(aspect,16,9);
mod(cur_hlookat,cur_hlookat,360);
pow(sqrt,val,0.5);
inc(variable, byvalue*, max*, min*)
dec(variable, byvalue*, min*, max*)
inc(i);
inc(frame,1,get(lastframe),0);
inc(ypos,30);
inc(view.hlookat, 2, 90, 90);
Math.*
roundval(variable, decimalplaces*)
roundval(val);
roundval(val,2);
copy(cur_hlookat,view.hlookat); mod(cur_hlookat,360); roundval(cur_hlookat,2); copy(cur_vlookat,view.vlookat); roundval(cur_vlookat,2); txtadd(msg,'looking at ',get(cur_hlookat),'/',get(cur_vlookat));
txtadd(destination, txt1, txt2*, txt3*, ...)
txtadd(picfilename,'%CURRENTXML%/pic_',get(pic),'.jpg');
txtadd(crop,'0|',get(ypos),'|333|285');
txtadd(pname, 'thumbbar_image_', get(i));
txtadd(layer[text].html,'[p]',get(data[txt1].content),'[/p]');
txtadd(msg,get(view.fovtype),'=',get(fov),'°');
subtxt(dstvar, srcvar, startpos, len)
indexoftxt(dstvar, txt, searchtxt, startindex*)
escape(var)
escape(var, text)
unescape(var)
unescape(var, text)
tween(variable, value, time*, tweentype*, donecall*, updatecall*)
tween(scale,2);
tween(rotate,90);
tween(width,50%);
onover="tween(alpha,0.7,distance(0.3,0.2));" onout="tween(alpha,1.0,distance(0.3,0.2));"
set(alpha,0); set(visible,true); tween(alpha, 1.0 ,0.3);
tween(layer[logo].width, get(destwidth));
set(layer[image].enabled,false); tween(layer[image].alpha,0.0,0.5,default,removeplugin(image));
set(view.stereographic,true); tween(view.vlookat, 90.0, 2.0); tween(view.fisheye, 1.0, 2.0); tween(view.fov, 150.0, 2.0);
stoptween(variable, ...)
ondown="tween(layer[text].y, 10, distance(400,0.7), linear);" onup="stoptween(layer[text].y);"
loadpano(xmlpath, vars*, flags*, blend*)
loadxml(xmlstring, vars*, flags*, blend*)
loadscene(scenename, vars*, flags*, blend*)
loadpano(pano2.xml);
loadpano(pano2.xml, null, MERGE, BLEND(1));
loadscene(scene1);
loadscene(scene1, null, MERGE, BLEND(1));
loadxml('<krpano><image><sphere url="pano.jpg"/></image></krpano>');
loadxml(get(data[xml].content), null, KEEPALL);
loadpano('%SWFPATH%/pano.xml', null, MERGE, BLEND(2));
loadpano(sphere.xml, image.hfov=1.0&view.limitview=fullrange);
openurl(url, target*)
openurl('http://krpano.com',_self);
openurl('help.html');
lookat(atH, atV, fov*)
lookat(0,0);
lookat(0,0,90);
loadpano(pano.xml); lookat(45.1, -20.2, 110.0);
lookto(toH,toV,fov*,motiontype*,shortestway*,nonblocking*,donecall*)
looktohotspot(hotspotname*, fov*, motiontype*, shortestway*)
moveto(toH, toV, motiontype*)
zoomto(fov, motiontype*)
moveto(100.0,5,linear(10));
zoomto(130,smooth());
lookto(33,-22,30,smooth(100,50,20));
looktohotspot(hotspot1);
looktohotspot(hotspot2, 40);
looktohotspot(hotspot3, 25, smooth(100,50,20));
looktohotspot(get(name));
adjusthlookat(desthlookat)
adjusthlookat(140); tween(view.hlookat, 140);
wait(parameter)
oninterrupt(break); lookto(150,30,70); wait(3); lookto(242,0,150); lookto(280,-10,50); wait(3);
loadpano(pano2.xml,null,MERGE,BLEND(2)); lookat(100,50,5); wait(BLEND); lookto(100,50,150);
oninterrupt(actions)
oninterrupt(break); lookto(150,30,70); wait(3); lookto(242,0,150); lookto(280,-10,50); wait(3);
oninterrupt( trace(user interrupt); ); lookto(0,0,90); lookto(90,0,90); lookto(180,0,90); lookto(270,0,90); lookto(0,0,90);
screentosphere(x,y,h,v)
spheretoscreen(h,v,x,y)
screentosphere(mouse.x, mouse.y, toh, tov);
showtext(text, textstyle*)
onhover="showtext(you are hovering me);"
onhover="showtext(style text,TEXTSTYLE);"
onhover="showtext(line 1[br]line 2[br]line 3);"
onhover="showtext([b]bold[/b] [i]italic[/i]);"
updateobject(updateall*, updatefov*)
set(image.hfov,1); updateobject(true,true);
updatescreen()
invalidatescreen()
addlayer(name)
addplugin(name)
addhotspot(name)
addlensflare(name, ath*, atv*)
addlayer(button); set(layer[button].url,button.jpg); set(layer[button].align,bottom); set(layer[button].x,10); set(layer[button].y,20); set(layer[button].onhover,showtext('hovering the new button')); set(layer[button].onclick, removelayer(button) );
addhotspot(newspot); set(hotspot[newspot].url,spot.png); set(hotspot[newspot].ath,150); set(hotspot[newspot].atv,30); set(hotspot[newspot].scale,0.7); set(hotspot[newspot].zoom,true); set(hotspot[newspot].onclick, removehotspot(newspot) );
addhotspot(polyspot); set(hotspot[polyspot].fillalpha, 0.25); set(hotspot[polyspot].borderalpha, 0.50); set(hotspot[polyspot].onclick, removehotspot(polyspot) ); set(hotspot[polyspot].point[0].ath,-10); set(hotspot[polyspot].point[0].atv,-10); set(hotspot[polyspot].point[1].ath,-10); set(hotspot[polyspot].point[1].atv,+10); set(hotspot[polyspot].point[2].ath,+10); set(hotspot[polyspot].point[2].atv,+10); set(hotspot[polyspot].point[3].ath,+10); set(hotspot[polyspot].point[3].atv,-10);
addlensflare(sun, 20, -60); set(lensflare[sun].set, FLARESET2); set(lensflare[sun].size, 0.7);
js( ...Javascript code... )
function test(p1, p2, p3) { alert(p1 +" hlookat=" + p2 + " vlookat=" + p3); }Code in the XML file:
onclick="js( test('Hello', get(view.hlookat), get(view.vlookat)) );"
fscommand(...)
showlog(state*)
trace(...)
trace('view.maxpixelzoom=', view.maxpixelzoom);
<events onkeydown="trace('keycode=',keycode);" />
onresize="trace('size=',stagewidth,'x',stageheight);"
onclick="trace('mouse clicked at ', mouse.x, ' / ', mouse.y);"
trace('xyz=',xyz,' get(xyz)=',get(xyz));
error(errormessage)