PDA

View Full Version : Passing custom variable with loadPano function


champro
02-22-2008, 06:05 PM
I believe I know a work around to this problem, but if anyone knows of a simpler solution please let me know.

Basically I would like to find a way to link a discrete Global onDtart function for each of 3 panos in a combobox I have set up. The idea is that when each pano loads a quick auto presentation will move you through a 360 move and then pause. Working from Patrick's "simple auto-presentation" tutorial I was planning to create 3 different global functions and then have onStart call the correct function based on which pano is loaded. I thought maybe the "linked" parameter would work if I created 3 onStart functions, 2 of which would be null because their pano wasn't loaded, but that doesn't quite work. Next I figured I could pass a variable or even use the panoName variable in the onStart function to get it to call the correct auto tour function, but I'm not sure if thats possible.

It occurs to me now that I may be making a problem out of something simple, the easiest way for this to work is to have the autorotate plugin set to do one 360 of the pano and then to turn off, so if there is a way to do this , it would probably be the best.

Any help is appreciated,
Duncan

champro
02-22-2008, 06:22 PM
So it seems the solution is as simple as an

onStart="pano.pan+=360,10000"

or close enough when I play with the timing, though it doesn't want to fire again when I load a second pano from the combo box, but I'm sure I'll figure that out shortly as well

cheathamlane
02-23-2008, 12:40 AM
Hey Duncan:

Maybe onTransitionEnd instead of (or in addition to) onStart?

zleifr
02-24-2008, 06:01 PM
Hi Duncan,

There is a really simple way to have 3 discrete onStart (or onTransitionEnd, or whatever event functions) for three discrete panos: write the three functions in <global>, as for example:
func1="do stuff"
func2="do other stuff"
func3="do stuff but better this time"
And then in global call one of the functions with onstart:
onstart="func1"
That will be the func that gets called with the initial pano when it is loaded. And on the hotspots, or whatever you are using to switch panos, put an additional command in there to switch the onstart value:
onClick="
onstart=func3;
loadPano(....);
"

So it is simply a matter of switch the onstart function value before you load a new pano.