birdseye
10-03-2007, 02:34 PM
Hi,
I try to make a virtual tour with a normal FFP but with a map in Flash.
I did the test with the example controller Combo and the localconnection stuff and this works fine. But now I want to use buttons (hotspots) in the map instead of the combobox.
I'm no AS3 Guru at all and I haven't any idea how do to this. What Code do I have to add to let the button load an XML file ?
Can anyone help me further?
see www.360vt.be
Tnx in advance,
Yvan.
birdseye
10-03-2007, 05:49 PM
Never mind, just found the solution myself.
jlounds
10-15-2007, 10:57 PM
Yvan,
Would you mind posting a quick follow-up on what you were able to find? I am stuck here, as well.
Thanks!
birdseye
10-19-2007, 08:39 AM
@ Jlounds... Sorry for my late reply. Here's is my code that I used in the flash map...
// Use the same name in spots.xml: <global controller="lc_test">
// Better use different controller names for different panorama applications
var controllerName:String = "lc_test";
// Master slot name:
var masterSlot:String;
// Slave slot name:
var slaveSlot:String;
// Begin of connection code (better use it as is).
var dumpSlot = controllerName+"_dump_"+Math.random();
var _lc:LocalConnection = new LocalConnection();
_lc.allowDomain("*");
_lc.connect(dumpSlot);
_lc.addEventListener(StatusEvent.STATUS, onStatus);
_lc.client = this;
function onStatus(info) {
if (info.level == "error") {
trace("No master connection detected.");
_lc.close();
_lc = null;
}
};
function setSlot(slot) {
masterSlot = controllerName+"_master_"+slot;
slaveSlot = controllerName+"_slave_"+slot+"_"+Math.random();
_lc.close();
_lc.connect(slaveSlot);
trace("set slave: "+slaveSlot);
startWatch();
};
_lc.send(controllerName+"_master_0", "getSlot", dumpSlot);
// end of connecion code
var panoName:String; // current pano name
var panoBusy:Boolean; // true if panorama is loading or a transition effect is in process
var timer:Timer; // timer
// start watching parameters "panoName" and "panoBusy":
function startWatch () {
timer = new Timer(500);
timer.addEventListener(TimerEvent.TIMER, sendQuery);
timer.start();
}
// send query:
function sendQuery (event:Event) {
// 3rd argument is array of askable parameters, 4th and 5th are connection name to callback
_lc.send(masterSlot, "getParams", ["pano.panoName","pano2.panoName"], slaveSlot, "callback");
}
// load new panorama:
function loadPano(name) {
if (masterSlot != null) {
_lc.send(masterSlot, "execute", "loadPano(?panoName="+name+",3000,stripes);");
}
}
//close map function
function closemap () {
_lc.send(masterSlot, "execute", "floorplan.staticX=0; floorplan.staticY=-420,400;pano.qualityStatic=low;floorplan-out.visible=1;close.visible=0;global.timer=1,1000,-,restoreQuality");
}
//floor buttons linkage
btn_etage_0.addEventListener(MouseEvent.CLICK, goto_etage_0);
btn_etage_1.addEventListener(MouseEvent.CLICK, goto_etage_1);
//floor buttons functions
mcPlan.verdiep1.alpha=0;
function goto_etage_0 (e:Event) {
mcPlan.verdiep0.alpha=1;
mcPlan.verdiep1.alpha=0;
}
function goto_etage_1 (e:Event) {
mcPlan.verdiep0.alpha=0;
mcPlan.verdiep1.alpha=1;
}
//hotspotbuttons linkage
mcPlan.verdiep0.pano1_btn.addEventListener(MouseEv ent.CLICK, doPano1);
mcPlan.verdiep0.pano2_btn.addEventListener(MouseEv ent.CLICK, doPano2);
mcPlan.verdiep0.pano3_btn.addEventListener(MouseEv ent.CLICK, doPano3);
mcPlan.verdiep0.pano4_btn.addEventListener(MouseEv ent.CLICK, doPano4);
mcPlan.verdiep0.pano5_btn.addEventListener(MouseEv ent.CLICK, doPano5);
mcPlan.verdiep1.pano6_btn.addEventListener(MouseEv ent.CLICK, doPano6);
//hotspotbuttons functions
function doPano1 (e:Event) {
_lc.send(masterSlot, "execute", "loadPano(?panoName="+"stripes/p1strip)");
closemap();
}
function doPano2 (e:Event) {
_lc.send(masterSlot, "execute", "loadPano(?panoName="+"stripes/p2strip)");
closemap();
}
function doPano3 (e:Event) {
_lc.send(masterSlot, "execute", "loadPano(?panoName="+"stripes/p3strip)");
closemap();
}
function doPano4 (e:Event) {
_lc.send(masterSlot, "execute", "loadPano(?panoName="+"stripes/p4strip)");
closemap();
}
function doPano5 (e:Event) {
_lc.send(masterSlot, "execute", "loadPano(?panoName="+"stripes/p5strip)");
closemap();
}
function doPano6 (e:Event) {
_lc.send(masterSlot, "execute", "loadPano(?panoName="+"stripes/p6strip)");
closemap();
}
Hope this helps...
Yvan.
jlounds
10-20-2007, 03:02 PM
Yvan,
Great, thanks! One question...
What does the "mcPlan.verdiep1." refer to? I cannot seem to find how it correlates to the localConnection or the pano itself.
Thanks again,
Jeremy
birdseye
10-22-2007, 04:13 AM
mcPlan.verdiep1 is a button that is visible on the 2nd floor. This button may not be visible on the 1st floor. therefore I set's it's alpha to 0. I'm not a AS genius and I'm almost sure there are some better solutions than this one.
Yvan.
vBulletin® v3.7.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.