Hi malojo,
I have played a little with that

...
First, I noticed that your loadrandom() action does not execute the call to your JavaScript function zufallsZahl()... The alert(ran_number); does not displays !!!
Second, (I am going to explain the way I understand, perhaps I am wrong and sure not the best explanation

) I think, the way you embed your panomax.swf does not allow javascript to communicate with him... there is no element ID to communicate with... Also, I do not think that return ran_number; can be the way to communicate with Krpano... Look at the
Javascript Interface Doc :
The krpano object exports this 3 functions to javascript
:
|
Quellcode
|
1
2
3
|
set(variable,value) ... sets the variable to the
get(variable) ... returns the value of the variable
call(action) ... calls a action
|
I think you have to use the method described in the doc
Flash Embedding Javascript using SWFObject 1.5 / SWFObject 2.1 .
So, your html code would be something like this:
|
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
|
<html>
<head>
<title>krpano Javascript</title>
</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" src="scripts.js"></script>
<script type="text/javascript">
// <![CDATA[
if (typeof(deconcept) !== 'undefined')
{
if (deconcept.SWFObjectUtil.getPlayerVersion().major >= 9)
{
var so = new SWFObject("panomax.swf","krpanoSWFObject","640","480","9.0.28","#000000");
so.addParam("allowFullScreen","true");
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>
|
Your scripts.js would be:
|
Quellcode
|
1
2
3
4
5
6
7
8
9
|
function krpano() {
return document.getElementById("krpanoSWFObject");
}
function zufallsZahl() {
var ran_number = Math.floor(Math.random()*5);
alert(ran_number);
krpano().set("myvar.vari",ran_number);
}
|
And your xml loadrandom() action would be:
|
Quellcode
|
1
2
3
4
5
|
<action name="loadrandom">
trace(myvar.vari);
js(zufallsZahl());
delayedcall(0.5,trace(myvar.vari));
</action>
|
note: I have delayed the second trace(myvar.vari) because it seems that there is some delay before the Javascript function zufallsZahl() is fully executed !!!
Hope this can help...
SAlut.