Javascript interface

Q&A about the latest versions
Post Reply
Posts: 73
Joined: Tue Jun 22, 2010 10:28 pm

Fri Jan 21, 2011 11:37 am

I have a requirement to synchronise he movement of two panos next to each other. I think to get them dynamically rotating together I'd need to use the Flash api - but as an interim I've tried using the javascript api.

My code is attached. Replace the swf file with one of your own choice - I don't want to publish the one I'm working on at the moment...

If I use the api inline (as per the example in the javascript api), it works fine, and my left pano will sync the right pano to the same pan/tilt/fov values.

Code: Select all

<a onClick=" var pan=l_pano.getPan();r_pano.setPan(pan);
                   var tilt=l_pano.getTilt();r_pano.setTilt(tilt);
                   var fov=l_pano.getfov();r_pano.setFov(fov);"
                   href="#">Sync the panos inline</a></p>
But I've created a function, and it fails. I get Type error, and 'l_pano.getPan' is not a function.

Code: Select all

<script type="text/javascript">
		function SyncPanos() {
			var pan = l_pano.getPan();
			r_pano.setPan( pan ) ;
			var tilt = l_pano.getPan() ;
			var fov = l_pano.getFov() ;

Called thus:

Code: Select all

><a onClick="SyncPanos()" href="#">Sync the panos use function</a>
Very stumped with why I can't use this as a function - as I'd much prefer to do this rather than use inline functions.
(2.06 KiB) Downloaded 139 times
Post Reply