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.
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.
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.