Hotspots are lost post 2.2?

Q&A about the latest versions
Post Reply
mikef
Posts: 11
Joined: Mon Jun 16, 2008 8:51 pm

Since the 2.3 I can't seem to get hotspots to stick around once I've loaded a new pano. Here is an example of what i'm doing:

Code: Select all

import flash.display.*;
import flash.net.URLRequest;
import flash.events.Event;
var loader:Loader;
loader = new Loader();
var url1:String = "1.swf";
var url2:String = "2.swf";
var urlReq1:URLRequest = new URLRequest(url1);
var urlReq2:URLRequest = new URLRequest(url2);
var hot_arrow:MovieClip=new arrow_lib;
var vr:MovieClip; // panorama movieclip

// This is done after the swf is loaded.
function finished_loading (e:Event) {
}

function initHandler(event:Event):void {
	trace("initHandler: " + event);
	vr = MovieClip(loader.content); // cast 'DisplayObject' to 'MovieClip'
	vr.isFlash10=true; // Disable Flash 10 rendering if the container is Flash 9
}

function initPanorama(e:Event) {
// check if the panorama object is available and initialize it
	if ((vr!=null) && (vr.pano!=null)) {
		removeEventListener( Event.ENTER_FRAME , initPanorama);
		vr.pano.setWindowSize(400,200); // resize the window
		vr.pano.setWindowPos(10,10); // reposition
		vr.pano.addHotspot("tag1",180,-90,hot_arrow);
	}
}
// call initPanorama every frame
addEventListener( Event.ENTER_FRAME , initPanorama);

// Tell the loader to call 'finished_loading' after the swf is loaded.
loader.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, finished_loading);
// Tell the loader to call 'initHandler' after the swf is initialized.
loader.contentLoaderInfo.addEventListener(Event.INIT, initHandler);
loader.load(urlReq1);
addChild(loader); // add your swf directly to the stage


hot_arrow.addEventListener(MouseEvent.CLICK, hot_arrowclickHandler);
function hot_arrowclickHandler(event:MouseEvent):void {
	
	vr.pano.openNext("2.swf");
	vr.pano.addHotspot("tag1",0,20,hot_arrow);
	
}
When I click the my button the new pano is loaded but the hotspots are all gone.

What am I doing wrong?
mikef
Posts: 11
Joined: Mon Jun 16, 2008 8:51 pm

Looking at it more I also looks any settings for pan and tilt when the new pano loads


I tried

Code: Select all

function initPanorama(e:Event) {
	
// check if the panorama object is available and initialize it
	
		if ((vr!=null) && (vr.pano!=null)) {

		removeEventListener( Event.ENTER_FRAME , initPanorama);
		
		if (id==1) {
		vr.pano.addHotspot("tag1",180,-90,hot_arrow);
		vr.pano.setWindowSize(400,200); // resize the window
		vr.pano.setWindowPos(10,10); // reposition
		vr.pano.setTilt(20);

	}
		
		if (id==2) {
		vr.pano.addHotspot("tag1",180,-90,hot_arrow);
		vr.pano.setWindowSize(400,200); // resize the window
		vr.pano.setWindowPos(10,10); // reposition
		vr.pano.setTilt(-60);

	}
		}
	
}
but even when the second pano is loaded it sets the tilt to 0 and there is no hotspot.

Anyone have any Ideas what I'm doing wrong?
mikef
Posts: 11
Joined: Mon Jun 16, 2008 8:51 pm

more messing around

when I make the button set the tilt like so:

Code: Select all

hot_arrow.addEventListener(MouseEvent.CLICK, hot_arrowclickHandler);
function hot_arrowclickHandler(event:MouseEvent):void {
	id=2;
	vr.pano.openNext("2.swf");
	vr.pano.setTilt(90);
	vr.pano.addHotspot("tag1",180,-90,hot_arrow);
	
	
}

when it loads the new pano it loads in the correct position and then 1 frame later it flips back to 0,0. why does it do this? I'm not sure what is telling it to remove the hotspots and go to 0,0. The still hotspot dosen't work either.
mikef
Posts: 11
Joined: Mon Jun 16, 2008 8:51 pm

It turns out the answer to my problem was at http://www.krpano.com/


You've got some catching up to do Thomas. The big boys are leaving you behind.
Post Reply