Hi there,
I am trying to override skin or layer settings using javascript, but I am not having much luck.
Can anyone help me with the order of execution when using embedpano and an onready callback function:
embedpano({
swf: "../assets/tour.swf"
,xml: "tour.xml"
,target: "pano"
,html5: "auto"
,mobilescale: 1.0
,bgcolor: "#00ff00"
,vars: {
ui_color: "0xFFFFFF"
ui_alpha: "0.5"
}
,onready : krpano_onready_callback
});
function krpano_onready_callback(krpano_interface) {
krpano = krpano_interface;
console.log("krpano ready");
if (krpano) {
krpano.set("skin_settings.design_bgcolor", "0xFFFFFF");
krpano.call("trace('skin_settings.design_bgcolor=', get(skin_settings.design_bgcolor));");
}
console.log("krpano_onready_callback ended");
}
Alles anzeigen
After I call embedpano() I get the following output in the console:
krpano ready
krpano_onready_callback ended
INFO: preinit action fired
INFO: onstart action fired
INFO: skin_settings.design_bgcolor=0x2D3E50
I would expect "skin_settings.design_bgcolor" to have been changed to "0x00FF00" when I called krpano.set() but it remains as the default from set in vtourskin.xml
I have also tried setting a layer's bgcolor with JS (in my callback function) but I cannot get this to work either:
krpano.set("layer[skin_floorplan_container].bgcolor", "0xFFFFFF");
krpano.call("trace('layer[skin_floorplan_container].bgcolor=', get(layer[skin_floorplan_container].bgcolor));");
Console output:
Do I need to call some a method to get these changes to be registered with krpano and displayed in the browser?
Hopefully one of you kind people can point me in the right direction!
Cheers
Olly