krpano动作脚本文档中英文对照参考.docx_第1页
krpano动作脚本文档中英文对照参考.docx_第2页
krpano动作脚本文档中英文对照参考.docx_第3页
krpano动作脚本文档中英文对照参考.docx_第4页
krpano动作脚本文档中英文对照参考.docx_第5页
免费预览已结束,剩余71页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

KRPANO技术文档Actions / Scripting dynamic XML code 动态XML代码krpano Actions / Scripting ReferenceVersion 1.17krpano has a small and simple dynamic scripting language. With it krpano can be customized in many ways. A command or function is calledactionin krpano. Its possible to use existing actions and also to define new ones. The scripting language is dynamic and basically untyped, only some predefined variables are typed, but that is normally not relevant because inside the scripts all type conversions will be done automatically.About this documentationThis documentation is about global krpano variables and objects, about the actions calling syntax and about all pre-defined krpano actions / functions.Documentation topics: Global-Variables Reference Actions / Functions Reference Syntax and Usagekrpano Global-Variables ReferenceVersion / Build information version xmlversion buildScreen information / settings fullscreen stagewidth / stageheight stagescale(HTML5 only) bgcolorDevice informations browser.useragent browser.platform 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.linuxMouse / Keyboard mouse.x / mouse.y / mouse.stagex / mouse.stagey keycode wheeldelta wheeldelta_rawTiming / Random values idletime timertick randomMath constants Math.PIKeyboard / Button moving hlookat_moveforce vlookat_moveforce fov_moveforceMultiresolution information multireslevel lockmultireslevel downloadlockedlevelXML / Scene xml.url xml.content xml.sceneDebugging / Error handling debugmode showerrors lasterror haveexternalinterface havenetworkaccessLayers (Flash only) image.layer layer.enabled/plugin.enabled layer.visible/plugin.visible layer.alpha/plugin.alpha layer.layer/plugin.layer hotspot.enabled hotspot.visible hotspot.alpha hotspot.layerkrpano Actions / Functions ReferenceProgramming logic / Flow control set get copy delete if ifnot resolvecondition delayedcall stopdelayedcall for asyncfor loop asyncloop switch push/pop stopall breakall events.dispatchMath operators add sub mul div mod pow inc dec Math.abs Math.acos Math.asin Math.atan Math.atan2 Math.ceil Math.cos Math.exp Math.floor Math.log Math.max Math.min Math.pow Math.round Math.sin Math.sqrt Math.tanNumber / String formating roundval txtadd subtxt indexoftxt txtreplace escape unscapeAnimations / Animated value changing tween stoptween tween typesDynamic loading of other panos (tours) loadpano loadscene loadxml openurlViewing animations / Camera control lookat lookto looktohotspot moveto zoomto adjusthlookat stoplookto wait oninterruptCoordinate transformation screentosphere spheretoscreenText visualization showtextView / Pano updates updateobject updatescreen invalidatescreenDynamic adding or removing of visible elements addlayer/addplugin removelayer/removeplugin addhotspot removehotspot addlensflare removelensflarePlugin / Hotspot Actions plugin / hotspotname.loadstyle(name) plugin / hotspotname.registercontentsize(imagewidth,imageheight) plugin / hotspotname.resetsize() plugin / hotspotname.updatepos() plugin / hotspotname.changeorigin(align,edge) plugin / hotspotname.getfullpath() hotspotname.getcenter(ath,atv)External / Javascript Interface js fscommandDebugging showlog trace errorSyntax and UsageThe calling conventions of krpano actions / functions:actionname(parameters); Theactionnamecan be either:o the name of a predefined krpanoactionor.o the name of anelement that was defined anywhere in the xml or.o the name of a krpano variable/attribute that contains krpano action code. Its possible to call severals actions at once, just end each action with a semicolon;. The actions will be processed one after the other. White-spaces (like spaces, tabs and new lines) between action calls and between parameters will be ignored. The number ofparametersto use depend on the called action. Parametersneed to be separated bycommas,. To be able to use white-spaces and commas in a parameter, the parameter must be enclosed by singleor double quotes. The givenparametersare passed as texts to the action. When the given parameter is the name of a variable, then the variable will be NOT resolved automatically to its value! Some actions are resolving variables automatically, but this depends on the action itself. To force resolving a variable and passing only the content/value of the variable use thegetaction. Have also a look to this great and very detailed explanations frompinsaneabout the krpanoactions and their arguments/parameters in thekrpano forum.Global VariablesMeaning and usage of the global krpano variables:variable name(read only)typedefault valueversionStringThe krpano version string, e.g. 1.16.variable name(read only)typedefault valuexmlversionStringTheversionsetting from the xml. When not set this will be the same number as the krpano version string.variable name(read only)typedefault valuebuildStringThe krpano build string, e.g. 2013-03-28.variable names(read only)typedefault valuemouse.xmouse.ymouse.stagexmouse.stageyintintintintThe current mouse position.Themouse.xandmouse.ycoordinates are relative to the left top edge of thearea and themouse.stagexandmouse.stageycoordinates to the left top edge of the whole stage/window.variable name(read only)typedefault valuekeycodeint0The keycode of the last pressed or released key.It will be set in theonkeydownandonkeyupevents.Note - here a small code snippet to find out the keycode of the pressed key:variable name(read only)typedefault valuewheeldeltaint0The delta of the mouse wheel rotation.This variable will be set in theonmousewheelevent.variable name(read only)typedefault valuewheeldelta_rawNumberNumber.NaNThe raw unscaled and non-rounded delta value of the mouse wheel rotation.The normalwheeldeltavalues 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 thedefault krpano embedding scriptand only in windowed-mode (not in Fullscreen mode)! In the krpano HTML5 viewer, the raw values are always available.variable nametypedefault valuefullscreenBooleanfalseThefullscreenvariable 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 xmlfullscreensupportdevices setting and thedevice.fullscreensupportvariable.HTML5 Notes - when theHTML5 Fullscreen Modeis 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 and can be problematic in nested html structures.variable names(read only)typedefault valuestagewidthstageheightintintThe size of the current window in pixels.Get the this size in theonresizeevent.variable names(HTML5 only)typedefault valuestagescaleNumber1.0A 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 Javascriptwindow.devicePixelRatiovalue 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)typedefault valuebrowser.useragentStringThe user-agent string of the browser.The same asnavigator.userAgentin Javascript.Note - this string will be only available when using thedefault embedding script.variable name(read only, html5 only)typedefault valuebrowser.platformStringThe platform string of the browser.The same asnavigator.platformin Javascript.variable names(read only)typedefault valuedevice.flashdevice.flashversiondevice.html5device.desktopdevice.mobiledevice.tabletdevice.css3ddevice.webgldevice.fullscreensupportdevice.pixelratiodevice.touchdevicedevice.gesturedevicedevice.iosdevice.iosversiondevice.iphonedevice.ipoddevice.ipaddevice.retinadevice.androiddevice.androidversiondevice.androidstockdevice.blackberrydevice.chromedevice.chromeversiondevice.firefoxdevice.firefoxversiondevice.iedevice.ieversiondevice.safaridevice.safariversiondevice.operadevice.operaversiondevice.airdevice.standalonedevice.windowsdevice.macdevice.linuxBooleanNumberBooleanBooleanBooleanBooleanBooleanBooleanBooleanNumberBooleanBooleanBooleanNumberBooleanBooleanBooleanBooleanBooleanNumberBooleanBooleanBooleanNumberBooleanNumberBooleanNumberBooleanNumberBooleanNumberBooleanBooleanBooleanBooleanBooleanfalsefalsefalsefalsefalsefalsefalsefalse1.0falsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalsefalseThedeviceobject provides information about the current device/system. Its the dynamic/scripting equivalent to thexmldevicesattribute.The attributes/properties of thedeviceobject can be checked anytime by scripting code, e.g. by theif()action.Thedeviceobject has these properties: flash- true only in the krpano Flash viewer flashversion- version of the Flashplayer (Flash only) html5- true only in the krpano HTML5 viewer desktop- true only on Desktop mobile- true only on Mobiles tablet- true only on Tablets css3d- true when CSS-3D-Transforms are available (HTML5 only) webgl- true when WebGL is available (HTML5 only) fullscreensupport- true only when the Fullscreen-mode is support pixelratio- the pixelratio of the device/browser touchdevice- true only on Touch devices gesturedevice- true only on Gesture (Multi-Touch) devices ios- true only on iOS devices (iPhone, iPod, iPad) iosversion- the iOS version of the device (iPhone,iPad,iPod only) iphone- true only on the iPhone (and iPod Touch) ipod- true only on the iPod Touch ipad- true only on the iPad retina- true only on iOS retina displays android- true only on Android devices androidversion- the Android version (HTML5 only) androidstock- true only in stock (=WebView-based) Android browsers blackberry- true only on BlackBerry devices chrome- true only in the Chrome browser (HTML5 only) chromeversion- version of the Chrome browser (HTML5 only) firefox- true only in the Firefox browser (HTML5 only) firefoxversion- version of the Firefox browser (HTML5 only) ie- true only in the Internet Explorer browser (HTML5 only) ieversion- version of the Internet Explorer browser (HTML5 only) safari- true only in the Safari browser (HTML5 only) safariversion- version of the Safari browser (HTML5 only) opera- true only in the (Presto-based) Opera browser (HTML5 only) operaversion- version of the Opera browser (HTML5 only) air- true only in the Adobe AIR Player standalone- true only in the Standalone Flashplayer windows- true only on Windows systems mac- true only on Mac OSX systems linux- true only on Linux systemsExamplesvariable names(read only)typedefault valueisflashishtml5ismobileistabletisdesktopisphoneispadisandroidistouchdeviceisgesturedeviceiosversionBooleanBooleanBooleanBooleanBooleanBooleanBooleanBooleanBooleanBooleanStringfalsefalsefalsefalsefalsefalsefalsefalsefalsefalse0Note - these variables are deprecated - use the newdeviceobject instead!Global device detection variables. isflash- true only in the Flashplayer (Desktop and Android) ishtml5- true only in the krpanoJS (HTML5) viewer ismobile- true only on an iPhone/iPod and on Android Mobile devices istablet- true only on an iPad and on Android Tablet devices isdesktop- true only on Desktop (Flash and HTML5) viewer isphone- true only on the iPhone (and iPod Touch) ispad- true only on the iPad isandroid- true only on Android devices istouchdevice- true only on Touch devices (iPhone,iPad,Android) isgesturedevice- true only on Gesture (Multi-Touch) devices iosversion- the iOS version of the device (iPhone,iPad,iPod only)variable name(read only)typedefault valuetimertickintThetimertickvariable returns the number of milliseconds that have elapsed since the viewer was started (1000 milliseconds = 1 second).variable name(read only)typedefault valuerandomNumber0.0 - 1.0Therandomvariable 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 namestypedefault valuehlookat_moveforcevlookat_moveforcefov_moveforceNumberNumberNumber0.00.00.0These 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 bykeybaccelerate) and move with a maximum speed (controlled bykeybspeed) until set back to 0.0, then it will slow down (controlled bykeybfriction).variable name(read only)typedefault valuemultireslevelintThemultireslevelvariable returns the current multi-resolution level(0-image.level.count).variable nametypedefault valuelockmultireslevelString-1Lock 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 nametypedefault valuedownloadlockedlevelBooleanfalseWhen set to true then the locked level will be downloaded completely.variable name(read only)typedefault valuexml.urlStringThexml.urlvariable contains the path/url of the currently loaded xml file.variable name(read only)typedefault valuexml.contentStringThexml.contentvariable contains the whole content of the currently loaded xml file as string.variable name(read only)typedefault valuexml.sceneStringThexml.scenevariable contains the name of currently loaded scene.variable name(read only)typedefault valuelasterrorStringThelasterrorvariable contains the last error message when an error had happened. To get this variable theonloaderrorevent must be used.variable name(read only)typedefault valuehaveexternalinterfaceBooleantrueThis variable can be used to check if the External Interface from the Flashplayer is available. This interface is necessary for theJavascript Interfaceand for theopenurlactions.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)typedefault valuehavenetworkaccessBooleantrueThis 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.Action Documentationsset(variable, value)Set the given variable to the giv

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论