Sie sind nicht angemeldet.

Lieber Besucher, herzlich willkommen bei: krpano.com Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

1

Dienstag, 15. September 2009, 18:02

easy way to access to a pano ?

Hi,

Let's say I'm on virtual tour where there is 15 panos.

I'd to know if there is an easy solution to access to one pano directly with url (without having 15 html and xml files...) ?

Something like http://www.mytour.com/index.html#pano12

Is there a way to use the # anchor with swfobject v2 ?

Thanks
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

2

Dienstag, 15. September 2009, 21:15

Hi nelk,

Yes, there is a way to do using javascript to retrieve a variable from the URL...
Ex: YourDomain.com/PanoTour?pano=panoToBeLoaded

I have used, as the base to illustrate the following, the scene example that come with Krpano_1.0.8 download.
In the scene.xml example, there is an action(onstart) called by the Krpano.onstart argument...
The action(onstart) is as follow:

Quellcode

1
2
3
<action name="onstart">
   loadscene(scene1, null, MERGE);
</action>

This action loads the scene to be loaded...
Then, using a javascript that retrieve the variable pano from the URL, in the scene.html file we go to change dynamically the content of this action with the scene we need to be loaded.
Like this: so.addVariable("action[onstart].content", "loadscene(" + pano + ", null, MERGE);");

The resulting scene.html file will be:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<html>
<head>
<title>krpano.com scenes example</title>

<script type="text/javascript">
pano = "scene1";   // Default pano to be loaded if not set in the URL
searchVariables = location.search.substring(1,location.search.length);
if (searchVariables!="") {
arrVariables = searchVariables.split("&");
for (i=0; i<arrVariables.length; i++) {
arrVariableActual = arrVariables[i].split("=");
if (isNaN(parseFloat(arrVariableActual[1])))
eval(arrVariableActual[0]+"='"+unescape(arrVariableActual[1])+"';");
else
eval(arrVariableActual[0]+"="+arrVariableActual[1]+";");
}
}
</script>

</head>
<style>
body{ font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#FFFFFF; background-color:#000000; margin:0; padding:0; }
* html, * html body{ overflow: hidden; }
a{ color:#AAAAAA; text-decoration:underline; }
a:hover{ color:#FFFFFF; text-decoration:underline; }
</style>
<body>

<div id="krpanoDIV">
<noscript><table width="100%" height="100%"><tr valign="middle"><td><center>ERROR:<br/><br/>Javascript not activated<br/><b/r></center></td></tr></table></noscript>
</div>

<script type="text/javascript" src="../../swfobject/swfobject.js"></script>
<script type="text/javascript" src="../../swfobject/swfkrpanomousewheel.js"></script>


<script type="text/javascript">
// <![CDATA[
if (typeof(deconcept) !== 'undefined')
{
 if (deconcept.SWFObjectUtil.getPlayerVersion().major >= 9)
{
var so = new SWFObject("../../krpano.swf","krpanoSWFObject","100%","100%","9.0.28","#000000");
so.addParam("allowFullScreen","true");

so.addVariable("xml", "scenes.xml");
so.addVariable("action[onstart].content", "loadscene(" + pano + ", null, MERGE);");

if (so.write("krpanoDIV")) { var mousewheelfixes = new SWFkrpanoMouseWheel(so); }
}
else
{
document.getElementById("krpanoDIV").innerHTML = '<table width="100%" height="100%"><tr valign="middle"><td><center>ERROR:<br><br>Adobe Flash Player 9 needed<br><br><br><a href="http://www.adobe.com/go/getflashplayer/"  target="_blank"><IMG SRC="http://www.macromedia.com/images/shared/download_buttons/get_flash_player.gif" BORDER="1"></a><br>...click here to download...<br><br><br><br></center></td></tr></table>';
}
}
else
{
document.getElementById("krpanoDIV").innerHTML = '<table width="100%" height="100%"><tr valign="middle"><td><center>ERROR:<br/><br/>swfobject.js not found<br/><br/></center></td></tr></table>';
}
// ]]>
</script>

</body>
</html>

Lines 5 to 18 are the javascript code that retrieve the variables from the URL...
Note the line 6.... here you set the default value to the variable pano if it is not set on the URL.
Line 47... this is the line that change the action[onstart].content

That's all. ;-)


note: this thread Banner without XML has helped me to get this code.

Salut.

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »michel« (15. September 2009, 21:44)


3

Dienstag, 15. September 2009, 23:16

Salut :-)

Thanks for your answer

I've few questions :


- For the code between line 7 and line 17 : I assume that arrVariableActual[0] is equal to pano ?

(I don't really understand javascript ...)


- on line 46 you have

Quellcode

1
so.addVariable("xml", "scenes.xml");


I had never see xml before in a variable.

Is there a difference between pano and xml ? Is variable xml more like include ?
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

4

Dienstag, 15. September 2009, 23:18

Is there a difference between pano and xml ? Is variable xml more like include ?


Hum ... for this question, I think I've found a solution myself in this topic : pano and xml are the same.
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

5

Mittwoch, 16. September 2009, 00:01

Hi nelk,

Zitat

- For the code between line 7 and line 17 : I assume that arrVariableActual[0] is equal to pano ?

I am not an expert... But I am going to explain what I understand here... *whistling*

Ex: YourDomain.com/PanoTour?pano=panoToBeLoaded&var2=value&var3=value&etc....

Code line 7 : searchVariables = location.search.substring(1,location.search.length);
result: searchVariables = pano=panoToBeLoaded&var2=value&var3=value&etc....


Code line 9 : arrVariables = searchVariables.split("&");
result: arrVariables[0] = pano=panoToBeLoaded
arrVariables[1] = var2=value
arrVariables[2] = var3=value
arrVariables[3] = etc....

Code line 10 : for (i=0; i<arrVariables.length; i++) {
going to make a buckle for each existing arrVariables[X]

Code line 11 : arrVariableActual = arrVariables.split("=");
result: arrVariableActual[0] = pano when on the first buckle
arrVariableActual[1] = panoToBeLoaded when on the first buckle
.....
arrVariableActual[0] = var2 when on the second buckle
arrVariableActual[1] = value when on the second buckle (edited: when on the first buckle)
and so on.....

Code line 13 :eval(arrVariableActual[0]+"='"+unescape(arrVariableActual[1])+"';");
this line is the one declare the variable=value
result:pano = panoToBeLoaded

Now, we have the variable pano to use in :
so.addVariable("action[onstart].content", "loadscene(" + pano + ", null, MERGE);");


Basically, this is what the javascript code dones....


Zitat

- on line 46 you have .....

Quellcode

1
1 so.addVariable("xml", "scenes.xml");


This is the code KLAUS use on his scene.html code ....

Hope I am understandable.... *blink* *g* (Really bad English)

Salut.

Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »michel« (17. September 2009, 04:09)


6

Mittwoch, 16. September 2009, 00:22

Hi nelk,

Try changing the scene.html from KLAUS scene example with the one above....

Open it (it will open the first scene) and add in the URL the_URL_to_sceneExample?pano=scene2 and reload...
It will open the second scene *attention* ;-)

Salut.

7

Freitag, 18. September 2009, 03:58

Hi nelk,

Have you found a way to do what you was looking for? If so, How? *rolleyes* I would like to know.. *thumbup*

Salut.

8

Freitag, 18. September 2009, 10:27

Hi,

thanks michel!
I was going to write the same

have also a look at the source code of krpano.html here - http://krpano.com/krpano.html
it works similar,

best regards,
Klaus

9

Donnerstag, 14. Januar 2010, 16:02

Hi,

I would like to achieve this (so.addVariable("action[onstart].content", "loadscene(" + pano + ", null, MERGE);");) with swfobject 2.2.

I tried this (line 5):

Quellcode

1
2
3
4
5
6
7
swfobject.embedSWF("krpano.swf", "panoramaDiv", 
"100%", "100%", "9.0.28", 
"basis/expressInstall.swf", 
{pano:"pano/heuvel.xml"},
{"action[onstart].content":"loadscene(" + pano + ", null, MERGE);"},
{allowfullscreen:true, bgcolor:"#000000"}, 
{id:'panoramaDiv', name:'panoramaDiv'});


...but it doesn't work. Any ideas?


Edit: already found out. Has to be like this:

Quellcode

1
2
3
4
5
6
swfobject.embedSWF("krpano.swf", "panoramaDiv", 
"100%", "100%", "9.0.28", 
"basis/expressInstall.swf", 
{pano:"pano/heuvel.xml", "action[onstart].content":"loadscene(" + pano + ", null, MERGE);"},
{allowfullscreen:true, bgcolor:"#000000"}, 
{id:'panoramaDiv', name:'panoramaDiv'});

10

Donnerstag, 14. Januar 2010, 16:17

Hi photo40,

edited: Forget this... see edited above.
Perhaps you can try in this way (just an idea, I have not tried):

Quellcode

4
{pano:"pano/heuvel.xml?action[onstart].content=loadscene(' + pano + ', null, MERGE);"},


SAlut.

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »michel« (15. Januar 2010, 19:31)