You are not logged in.

  • "Douglas Rhiner" started this thread

Posts: 99

Location: Fairfax, CA

Occupation: Code-Slave

  • Send private message

1

Sunday, January 13th 2013, 9:54pm

Randon player ID being created?

I have a function to initiate a viewer instance:


function startHotPano(panodiv, hotscene)
{

var viewer13 = createPanoViewer({swf:"krpano.swf",id:"thePanoObject",target:panodiv});
<!--viewer.useHTML5("whenpossible"); -->
var url = "sceneXML.php?hotscene="+hotscene+"&newhot=true"
var encurl = encodeURIComponent(url);
var hs = "editSpot";

viewer13.addVariable("xml", encurl); <!--- content/editLocationTest.xml --->
viewer13.addParam("wmode", "opaque");
viewer13.embed();
start_getspot(hs);
};

Every other time it is invoked, the "id:" gets a random numeric suffix added to it....

<embed type="application/x-shockwave-flash" src="krpano.swf" width="100%" height="100%" style="outline:none;" id="thePanoObject4" name="thePanoObject4" bgcolor="#000000" allowfullscreen="true" allowscriptaccess="always" wmode="opaque" flashvars="browser.useragent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17&amp;xml=sceneXML.php%3Fhotscene%3D365%26newhot%3Dtrue">


Any ideas as to why this is happening or what could possibly be causing this?
No wehre in my code is there any function that appends / modifies the id: attribute.

  • "Douglas Rhiner" started this thread

Posts: 99

Location: Fairfax, CA

Occupation: Code-Slave

  • Send private message

2

Wednesday, January 16th 2013, 5:18am

Been banging on this to no avail.
Every second ( every other ) time the script runs, the darn "suffix" is added.....

Anyone?

3

Thursday, January 17th 2013, 10:39am

Hi,

this is an automatic fix/workaround of the embedding-script when there is already an object with the given id.
Note - the id must be unique for each viewer!

If you are trying to replace a current viewer by embedding it again - this will not work - the script not remove an existing viewer.
In such case it would be MUCH better to embed the viewer only once and use the Javascript interface to load new panos inside that one viewer.

Best regards,
Klaus