PDA

View Full Version : Strange behavior of panorama.hotspots.hotspots_obj


zaroundus
11-28-2007, 10:20 PM
Hey all,

I have been working on an application for weeks and have not been able to get the current pano's panoName value to pass to my main application. The tour is due tomorrow afternoon so I'm under a little pressure. ;)

Through reading these forums for days I have been able to finally determine a way to access the panoName except for the first panorama loaded. I am including as much of my code as is necessary to explain this. If anyone can help I would be indebted to you forever.

//This is how I load and add my initial panorama
var panorama:MovieClip;
var loader:Loader = new Loader();
loader.load(new URLRequest("pano.swf"));
addChild(loader);

//Eventhandler for load completion
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE, loadComplete);

//This is where I handle the completion of loader
function loadComplete (e:Event) {
//Loading panorama
panorama = loader.content as MovieClip;
panorama.setArea(175,50,782,470);
panorama.loadPanorama("?panoName=sbay_01_1&xml_file=pano.xml");

//Here is an event listener for buttons in my main application
h1Btn.addEventListener(MouseEvent.CLICK, h1Swap);
}

//Here is the function used by h1Btn
function h1Swap(e:Event) {
//Here is the way the button loads a new panorama
panorama.externals.hotspots.hotspots_obj.execute("loadPano(?panoName=panos/sbay_01_1&xml_file=pano.xml)");

//This line works fine but does not work in loader completion handler
trace(panorama.externals.hotspots.hotspots_obj.pan oName);
}

If I attempt to call the trace above from the loader's completion handler I get the following error:

ReferenceError: Error #1069: Property hotspots not found on PanoController and there is no default value.

I attempted to use a Timer function to monitor the bytesLoaded within panorama with the following code:

function timerHandler(t:Event) {
var bytesTot = panorama.loaderInfo.bytesTotal;
var currBytesLoaded = panorama.loaderInfo.bytesTotal;
if (bytesTot == currBytesLoaded) {
trace(panorama.hotspots.hotspots_obj.panoName);
}
}

This just gives the same error as above but it just repeats while Timer is running. I am so frustrated at this point so I turn to the incredibly helpful people here with the hope that someone can point me in the right direction. I am a professional programmer and this I am still unable to figure it out.

As a side note, I tried the following code in the loader's completion handler Flash returned errors:

panorama.externals.hotspots.hotspots_obj.execute("loadPano(?panoName=panos/sbay_01_1&xml_file=pano.xml)");

Any help would be terrific!!

Zach

zleifr
11-29-2007, 03:44 PM
I am still uncertain as to what you have working right now and exactly which line is giving you that error, more information would be helpful: does sbay_01_1 load and display? More of the trace from flashlog would be helpful, which function is throwing the error?

Have you tried this?: (no hotspots_obj)
panorama.externals.hotspots.execute("loadPano(?panoName=panos/sbay_01_1&xml_file=pano.xml)");

or: (no ?)
panorama.externals.hotspots.execute("loadPano(panoName=panos/sbay_01_1&xml_file=pano.xml)");

or (& after pano.xml)
panorama.externals.hotspots.execute("loadPano(?panoName=panos/sbay_01_1&xml_file=pano.xml&)");


And if you can provide a link to it that would be extremely helpful.