heartglow
09-26-2007, 10:57 AM
Hi,
I'm developing a Virtual Tour viewer based on Java, please have a look at http://plush-world.com/test/template3sixty.html . But there is an error message that I cannot figure out how to solve.
Here is the error message I get:
Line 306
Char 39
Error 'pd [...]. optstr' is null or not an object
Code: 0
I don't get it.... Please HELP as soon as possible, very appreciated!
Best wishes
Ole
Kostas Zotos
09-27-2007, 01:43 PM
Hi,
At first nice applet panoramas..
That which looks odd to me is the last line of this (javascript) code of your HTML document (you have a comma after the last element in your array but not any element after that, and maybe this interpreted as a null object.. The array's length is not actually equal to the real number of objects.. ):
(Just an assumption since i don't know details of your code and this looks to me as a javascript possible error.. that maybe causes the problem)
var pd =[
{optstr:"Showroom 1", desclink:"", panostr:"{file=pictures/IMG_6447_plush.jpg}{fov=95}{tilt=0}{pan=0}"},
{optstr:"Showroom 2", desclink:"", panostr:"{file=pictures/IMG_6453_plush.jpg}{fov=95}{tilt=0}{pan=-20.94}"},
{optstr:"Showroom 3", desclink:"", panostr:"{file=pictures/IMG_6473_plush.jpg}{fov=95}{tilt=0}{pan=-39.03}"},
{optstr:"Showroom 4", desclink:"", panostr:"{file=pictures/IMG_6488_plush.jpg}{fov=95}{tilt=0}{pan=5.67}"},
{optstr:"Showroom 5", desclink:"", panostr:"{file=pictures/IMG_6500_plush.jpg}{fov=95}{tilt=0}{pan=0}"},
{optstr:"Showroom 6", desclink:"", panostr:"{file=pictures/IMG_6506_plush.jpg}{fov=95}{tilt=0}{pan=0}"},
{optstr:"Showroom 7", desclink:"", panostr:"{file=pictures/IMG_6512_plush.jpg}{fov=95}{tilt=0}{pan=107.01}"},
];
Kostas Zotos
09-28-2007, 11:52 AM
Just to add this:
The extra comma I've reported in the previous post, increases the array's length by one while your actual elements are less (by one). You have 7 array entries but the comma makes the array's length to be 8 (which shouldn't)
Then when use the following "for" loop to initialize your selection drop down in your HTML:
"for (i=1; i<pd.length; i++) document.write('<option value="' + i + '">'+ pd[i].optstr + '</option>');"
the "i" variable which have been set to be less than array's length (i< pd.length) takes a max value 7 (since increased inside "for" while less than 8), but the element "pd[7].optstr" simply doesn't exist since your array's seven elements span from pd[0] to pd[6].
[I am sure you know of cource that the first array's element has an index equal to zero, -zero based- so the last element has an index equal to length-1 :)]
The "for" loop condition: (i< pd.length) is OK except that the length is not correct.. The problem is the last comma which give an erroneous (greater by one of what should be) array length.. (at least in Internet Explorer as I think for example the mozilla not take this extra comma into account..)
Kostas