I continue with - how to access to the plugin itself:
if you know the "name" of the plugin,
this name:
you can just use:
var pluginobject:Object = krpano.get("plugin[pluginname]");
to get a object to access all attributes of the plugin,
if the name is not fixed (the common case) add a a special "register plugin" event listener to get the path/name of the plugin:
krpano.addPluginEventListener(this, krpano_as3_interface.PLUGINEVENT_REGISTER, registerEvent);
this event is dispatched from krpano after loading to the plugin, krpano passes a "DataEvent" Object with the name/path of the plugin:
function registerEvent(evt:DataEvent):void
{
var pluginpath:String = evt.data;
var pluginobject:Object = krpano.get(pluginpath);
}
now you can read the attributes of the plugin,
or add attributes or function,
e.g. - to add a function that can be called from XML or from a other plugin - just do this:
function plugin_test_hello():void
{
// start debug and trace to the krpano log (open it by pressing 'O' in the viewer)
krpano.trace(krpano_as3_interface.STARTDEBUGMODE, "start debug mode");
krpano.trace(krpano_as3_interface.INFO, "hello from plugin");
}
// create a new function just by assigning it:
// (only one important note - all functions and attributes must be lowercase!)
pluginobject.myfunction = plugin_test_hello;
Alles anzeigen
to access this function from XML, e.g. on a hotspot click:
any questions for the moment?