send command from html to krpano?

How i can send command from HTTP (javascript) to KRPano for load new XML file and load other panorama?

__________________

krpano new user Smile

Did you get a look at that

Did you get a look at that page ? http://www.krpano.com/docu/html/ it might help you if you didn't get a look at it !

Vincèn

__________________

http://www.skivr.com

re: send command from HTML to krpano

Hmm... That link shows how to embed your krpano presentation in a Web page, but not how to communicate from the Web page to krpano.

This page http://www.krpano.com/docu/js/ is probably what would help, but isn't complete yet.

In any case, I'm guessing ExternalInterface?

__________________

Patrick Cheatham
Forum Administrator

HR1 wrote: How i can send

HR1 wrote:

How i can send command from HTTP (javascript) to KRPano for load new XML file and load other panorama?

Hi,

krpano exports this 3 functions:

  set(variable,value) ... sets a variable to a value
  get(varible)        ... returns the value of a variable
  call(action)        ... calls a action

with the get/set functions you can change any of the varaibles
listed here:

http://krpano.com/docu/api/

and with the call function you can call this actions: (one or more)

http://krpano.com/docu/actions/

to access it from Javascript:

the second parameter in this line is the name of the krpano object (krpanoSWFObject)

var so = new SWFObject("krpano.swf", "krpanoSWFObject", ...);

to make a call now, get this object, and for example call a function:

var krpano = document.getElementById("krpanoSWFObject");
krpano.call("loadpano(nextpano.xml);");

that's it Wink

here some examples:

to load and blend in 1 second:

krpano.call("loadpano(nextpano.xml,null,keepbase,blend(1));");

to zoom in, and load a other image, blend and zoom out

krpano.call("zoomto(10);loadpano(null,sphere=pano1.jpg,keepbase,blend(1),setfov(10);wait(blend);zoomto(120););");

or to set the field of view to 120 degree and disable the fisheye effect:
(special case - to update the view immediately, you must set(update,view))

krpano.set("view.fov", "120");
krpano.set("view.fisheye", "0");
krpano.set("update", "view");

to look to a given position, wait 1 second, and then move to the next position

krpano.call("lookto(170,30,120);wait(1);lookto(0,0,90);");

it's also possible to the call a javascript function from krpano,
e.g.

krpano.xml:

...
<plugin name="button" url="button.png" onclick="js(jstest());" ... />
...

html/js file:

...
function jstest()
{
  alert("hello from krpano");
}
...

best regards,
Klaus

not worked

Sad
not worked

i write this

...

<SCRIPT type=text/javascript>
function loadpanoto () {

 var krpano1 = document.getElementById("krpanoSWFObject");
krpano1.call("loadpano(p02.xml);");
}
</SCRIPT>

...

<div id="krpanoframe">
<noscript>
...
</noscript>
</div>

...

<script type="text/javascript">
// <![CDATA[
        if (typeof(deconcept) !== 'undefined' && deconcept.SWFObjectUtil.getPlayerVersion().major >= 6)
        {
                var so = new SWFObject("../pano/krpano.swf", "krpanoSWFObject", "100%", "350", "9.0.28","#000000");
                so.addParam("allowFullScreen","true");
                so.addParam("allowScriptAccess","sameDomain");
                so.addVariable("pano", "p01.xml");
                so.useExpressInstall('../swfobject/expressinstall.swf');
                so.setAttribute('xiRedirectUrl', window.location);
                if ( so.write("krpanoframe") ) { var macmousewheel = new SWFMacMouseWheel(so); }
        }
        else
        {
.....}
// ]]>
</script>

....

<p><a href="javascript:loadpanoto()"><img src="pict/b1.jpg"/></a></p>

AND NOT WORKED!

__________________

krpano new user Smile

test

i tested it

function loadpanoto (type, args) {

  alert(document.getElementById("krpanoSWFObject"));
 
  var krpano1 = document.getElementById("krpanoSWFObject");
  alert (krpano1);
 
 krpano1.set("view.fov", "120");

  alert("FINE");
 

}

return messages

1. [object HTMLEmbedElement]
2. [object HTMLEmbedElement]
3. -> nothng!!!!

after
krpano1.set("view.fov", "120");
is java aborted? not send message FINE

__________________

krpano new user Smile

Hi, one question - where do

Hi,

one question - where do you test it - on a server or locally?

when testing locally - the flash security settings needed to be changed to allow javascript access.

to change the settings have a look at here:

http://krpano.com/docu/localaccess/

you can check this by pressing the 'O'-key in the panorama:

if there is the message:
"WARNING: not local trusted - ExternalInterface disabled!"

then you need to change the security settings or test it on a server (e.g. localhost or on the web)

regards,
Klaus

trusted folders

My local folder trusted for flash.

I press O and not see message - "WARNING: not local trusted - ExternalInterface disabled!"

I can see krpano flash, work with him, click to hotspot and load other panoramas (xml)

BUT SCRIPT NOT WORKED! Sad

Can you see me worked web page for exemple in Internet? Please.

__________________

krpano new user Smile

hmm... interesting, which

hmm... interesting, which browser do you use?

here some examples from my site:

http://krpano.com/examples/javascript1/

http://krpano.com/examples/javascript2/

http://krpano.com/examples/javascript3/

the first example loads a other pano on click on the thumbs
(loading with blending/zooming with the links on the right side)

the second examples shows how to move in the pano, and how to get values from it

and the third show hot to show a html element over the flash (but this doesn't work in Opera, which doesn't supports html over flash)

best regards,
Klaus

YES!!! Java script is working!!!

Thank you Klaus!!!
Big Grin Big Grin Big Grin

Java script is working!!!!

Your examples are very easy for studying

Applause Applause Applause

__________________

krpano new user Smile