Javascript API...

Q&A about the latest versions
Aduffy
Posts: 24
Joined: Wed Sep 03, 2008 8:40 pm

Thomas in your announcement for 2.1, you mentioned that there is now a JavaScript API, and that you would post more info "When I get back" ... Since I see you posting I assume you are back from where ever you managed to get away to, so ... How goes the API documentation??

:-)

Cheers.
User avatar
thomas
Chief Gnome
Posts: 2617
Joined: Fri Sep 01, 2006 3:56 pm
Location: Vienna, Austria
Contact:

Got me.... Here is the JavaScript API. Please note: You should use the newest version of the p2q_embed_object.js file or you can just enable the JavaScript interface in the "normal.ggt" HTML template. You can also see a demo at here.
MfG, Thomas
ramirox3
Posts: 51
Joined: Tue Apr 03, 2007 6:16 am
Location: Medellín Colombia

hi

the pano is not shown, Why?
I must replace the entire contents of html or single lines that are different?
<thanks
User avatar
thomas
Chief Gnome
Posts: 2617
Joined: Fri Sep 01, 2006 3:56 pm
Location: Vienna, Austria
Contact:

You just need to change the one line to

Code: Select all

p2q_EmbedFlashId('pano','test.swf','640','480','allowFullScreen','true','FlashVars','externalinterface=1');
or just regenerate a HTML page with the HTML template.
MfG, Thomas
ramirox3
Posts: 51
Joined: Tue Apr 03, 2007 6:16 am
Location: Medellín Colombia

Thanks Thomas
The pano already shown, but does not move to the selected points, does not jump and no sample text autorotator right and left
User avatar
thomas
Chief Gnome
Posts: 2617
Joined: Fri Sep 01, 2006 3:56 pm
Location: Vienna, Austria
Contact:

Can you post your code?
MfG, Thomas
ramirox3
Posts: 51
Joined: Tue Apr 03, 2007 6:16 am
Location: Medellín Colombia

It works, I'm sorry it had tested only locally, on the Web if it works.
do you would suggest how I changing the coordinates in numbers as a text like the demo and how I can place one title of pano?
Thanks

http://eneconpalito.com/ramiro/solaris_ ... s_out.html

My code is
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title></title>
<script type="text/javascript" src="p2q_embed_object.js">
</script>
<style type="text/css" title="default">
body, div, h1, h2, h3, span, p {
font-family: Verdana,Arial,Helvetica,sans-serif;
color: #000000;
}
body {
font-size: 10pt;
background : #bdbcbc;
}
table,tr,td {
font-size: 10pt;
border-color : #777777;
background : #dddddd;
color: #000000;
border-style : solid;
border-width : 1px;
}
h1 {
font-size: 18pt;
}
h2 {
font-size: 14pt;
}
.warning {
font-weight: bold;
}
</style>
</head>
<body>
<h1></h1>
<p>
<script type="text/javascript">
<!--
function getFlashMovie(movieName) {
var isIE = navigator.appName.indexOf("Microsoft") != -1;
return (isIE) ? window[movieName] : document[movieName];
}
if ((window.p2q_Version) && (window.p2q_Version>=2.2)) {
var flashvars="";
// enable javascript interface
flashvars+="externalinterface=1&pan=22";


p2q_EmbedFlashId('pano','solaris_out.swf','640','480','allowFullScreen','true','FlashVars','externalinterface=1');

// Check to see if the version meets the requirements for playback
if (!DetectFlashVer(9,0,0)) {
document.write('<p class="warning">This content requires Adobe Flash Player Version 9 or higher. '
+ '<a href="http://www.adobe.com/go/getflash/">Get Flash<\/a><\/p>');
}
} else {
document.writeln('<p class="warning">p2q_embed_object.js is not included or it is too old! Please copy this

file into your html directory.<\/p>');
}
//-->
</script>
<noscript>
<p class="warning">Please enable Javascript!</p>
</noscript>
<br>
<a onClick="pano.moveTo(357,90,70,10);" href="#">Move To 357,90</a>
<a onClick="pano.moveTo(357,-90,70,3);" href="#">Move To 357,-90</a>
<a onClick="pano.moveTo(243,2);" href="#">Move To 234,2</a>
<a onClick="pano.moveTo(173,0);" href="#">Move To 173,0</a>
<a onClick="pano.moveTo(74,-0);" href="#">Move To 743,-0</a>

</body>
</html>
Aduffy
Posts: 24
Joined: Wed Sep 03, 2008 8:40 pm

Thomas, can I ask why you chose to set a custom flashvar with externalinterface=1 instead of using the built in standard of AllowScriptAccess?

http://kb.adobe.com/selfservice/viewCon ... d=tn_16494
User avatar
thomas
Chief Gnome
Posts: 2617
Joined: Fri Sep 01, 2006 3:56 pm
Location: Vienna, Austria
Contact:

Aduffy wrote:Thomas, can I ask why you chose to set a custom flashvar with externalinterface=1 instead of using the built in standard of AllowScriptAccess?
Because this value defines the access in the other direction (from the pano to the HTML). I turned the external interface off by default, to avoid the security error message.
MfG, Thomas
User avatar
thomas
Chief Gnome
Posts: 2617
Joined: Fri Sep 01, 2006 3:56 pm
Location: Vienna, Austria
Contact:

ramirox3 wrote:It works, I'm sorry it had tested only locally, on the Web if it works.
do you would suggest how I changing the coordinates in numbers as a text like the demo and how I can place one title of pano?
I don't understand..... You can write any text or image between the anchor tag (e.g. <a ... onClick="...">Some Text</a>). You can also use other elements to trigger the javascript code. What do you mean with "how I can place one title of pano"?
MfG, Thomas
Aduffy
Posts: 24
Joined: Wed Sep 03, 2008 8:40 pm

thomas wrote:
Aduffy wrote:Thomas, can I ask why you chose to set a custom flashvar with externalinterface=1 instead of using the built in standard of AllowScriptAccess?
Because this value defines the access in the other direction (from the pano to the HTML). I turned the external interface off by default, to avoid the security error message.
OK. Got you. So we would also need to make sure AllowScriptAccess was enabled as well..

Perhaps instead of (or as well as) setting this in a flasvar at the time of embedding, it could be a check box in pano2vr ??
Aduffy
Posts: 24
Joined: Wed Sep 03, 2008 8:40 pm

Oh never mind.. there are no callbacks (at this point) so the flash file is never accessing the JS functions hence no need for AllowScriptAccess...
ramirox3
Posts: 51
Joined: Tue Apr 03, 2007 6:16 am
Location: Medellín Colombia

Thanks Thomas
It works well
thanks
User avatar
Hopki
Gnome
Posts: 13039
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi Thomas

Have been playing with the JavaScript API which took some doing as not very good at code.

http://www.hopkimedia.co.uk/Test%20Pano ... Panos.html

It works but with errors on the page, I noticed that your demo does also.
Do you know why there are errors?
It all works fine but looks bad.

Kind regards
Hopki
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
User avatar
thomas
Chief Gnome
Posts: 2617
Joined: Fri Sep 01, 2006 3:56 pm
Location: Vienna, Austria
Contact:

Hopki wrote:Do you know why there are errors?
It all works fine but looks bad.
You should only get those if you start it locally. Do you also get it if you start it from the web page? Can you post a screen shot?
MfG, Thomas
Post Reply