JavaScript API | Object2VR

Your object VRs can be controlled with JavaScript from the HTML page.

JavaScript API calls

Viewing direction

obj.getPan(); // returns the current pan angle
obj.setPan(angle_in_degrees:Number); // sets the current pan angle
obj.changePan(offset_in_degrees:Number); // change the current pan angle
obj.getTilt(); // returns the current tilt angle
obj.setTilt(angle_in_degrees:Number); // sets the current tilt angle
obj.changeTilt(offset_in_degrees:Number); // change the current tilt angle

obj.getFov(); // returns the current FoV
obj.setFov(angle_in_degrees:Number); // sets the current FoV
obj.changeFov(offset_in_degrees:Number); // change the current FoV

obj.setPanTilt(pan:Number, tilt:Number); // set angles for pan and tilt
obj.setPanTiltFov(pan:Number, tilt:Number, fov:Number); // set angles for pan, tilt and fov
obj.showObjectImage(x:Number, y:Number); // show the image with the given coordinates
obj.getX(); // returns the pan coordinate of the current image
obj.getY(); // returns the tilt coordinate of the current image 
obj.moveTo(column:Number, row:Number, zoom:Number, speed:Number ); // move to position
obj.moveToDefaultView(speed:Number); // move to default view

Other calls

obj.getState(); // returns the current viewing state 
obj.changeViewState(newstate:Number,speed:Number); // change the current view state with a blend transition  

obj.changeViewMode(v:Number) // change the control type (Grabber, Scroller). Values can be 0, 1 or 2, where 2 is toggle

obj.polygonMode(); // returns the current polygon mode
obj.changePolygonMode(v:Number); // change the polygon mode

obj.startAutorotate(speed:Number, delay:Number, returnToHorizon:Number); // starts the auto rotation
obj.stopAutorotate(); // stop auto rotation
obj.toggleAutorotate(); // toggle auto rotation

obj.setFullscreen(v:Boolean); // turn fullscreen on or off
obj.toggleFullscreen(); // toggle fullscreen mode
obj.exitFullscreen(); // exit fullscreen mode

obj.openUrl(url:String, target:String); // open a URL
Example: An object with 12 columns 4 rows (0-3), and 1.5x zoom
<a onClick="obj.moveTo(5, 3, 150, 1 ); // move to position;" href="#">Move To Column 5, Row 3 and FoV 150 speed 1</a>

See also

Flash API (Pano2VR)
Flash Output Settings: HTML Tab