PDA

View Full Version : Help needed with combobox.


birdseye
09-03-2007, 12:32 PM
I'm working on a Virtual Tour fot a hotel and I try to use a combobox, just as in the example files.
But I can't get it to work.

For the combo data parameters, I used the xml file names. f.ex... s_sauveur_2.xml,s_sauveur_4.xml

This is the website.... http://www.birdseye.be/panoramas/vt_sainsauveur

When you choose a new pano in the combobox, nothing happens...

Here is the complete AS code of the controller file.

[/code]

// Use the same name in spots.xml: <global controller="lc_test">
// Better use different controller names for different panorama applications
var controllerName = "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_"+random(1000000);
var _lc = new LocalConnection();
_lc.allowDomain = function () {
return true; // allow all connections
}
_lc.connect(dumpSlot);
_lc.onStatus = function(info) {
if (info.level == "error") {
trace("No master connection detected.");
_lc.close();
delete _lc;
}
};
_lc.setSlot = function(slot) {
masterSlot = controllerName+"_master_"+slot;
slaveSlot = controllerName+"_slave_"+slot+"_"+random(1000000);
_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 iid:Number; // interval id

// start watching parameters "panoName" and "panoBusy":
function startWatch () {
iid = setInterval(this, "sendQuery", 500);
}
// send query:
function sendQuery () {
// 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");
}
// listener function:
_lc.callback = function(values) {
// store panoName
panoName = values[1] != null ? values[1] : values[0];
// if the second panorama is not null, set busy flag:
panoBusy = values[1] != null;
if (panoName != _cb.getSelectedItem().data) {
var n = _cb.length;
for (var i=0; i<n; i++) {
if (_cb.getItemAt(i).data==panoName) {
_cb.setSelectedIndex(i);
}
}
}
};

// remove focus manager, let the panorama has the focus
focusManager.enabled = false;
focusManager = null;
_cb.tabEnabled = false;

// fix Macromedia's bug with combobox (bad work inside a loaded movie):
_cb._lockroot = true;

// register change handler for the combobox:
_cb.addEventListener("change", changed);

function changed() {
// remove focus rectangle
_cb.focus_mc._visible = 0;
_cb.__dropdown._visible = 0;
// roll back changes if panorama loader is busy:
if (panoBusy) {
return;
}
panoBusy = true;
// load new swf file:
loadPano(_cb.getSelectedItem().data);
}

// load new panorama:
function loadPano(name) {
if (masterSlot != null) {
_lc.send(masterSlot,"execute","loadPano(?panoName=newPano&xml_file="+name+");");
}
}

[/code]


I'm not an actionscript Guru at all and I was hoping anyone can help me further.

Thanks in advance,

Yvan.

birdseye
09-05-2007, 04:38 PM
Nevermind... just find the solution myself...

Yvan. ;)