detect if it's hotspot or plugin

  • Hi,

    My .swf could be load in a hotspot or a plugin

    If I make a trace like this :

    Code
    function registerEvent(evt:DataEvent):void
    {
    	var plugin_path:String = evt.data;
    	var plugin_object:Object = krpano.get(plugin_path);
    
    
    	trace(plugin_object);	
    }

    Flash tracer give me this two objects :

    [object krpano_hotspot] or [object krpano_plugin]

    but is there a way, with this objet, to know if it's a hotspot or plugin objet simply ?

    The purprose is to catch the value of my xml

    And I have to put

    Code
    krpano.get("hotspot["+name+"].sound");

    in one case, and

    Code
    krpano.get("plugin["+name+"].sound");

    in the other

    Ps : when I paste the code, some of if switch in smiley ... A litte bit boring ...is there a way to disable it ?


  • but instead of using "krpano.get()" for each attribute you can also "get" the plugin/hotspot object
    and then access the attribute direct:

    Code
    var plugin_obj:Object = krpano.get(plugin_path);
    
    
    var sound:String = plugin_obj.sound;

    this access is much faster
    and the "get" of the "plugin_obj" could be only once if the object variable was defined in a global context
    (but that's only important if you make serval thousands get() requests per frame )

    this access is possible since the 1.0.7 version, but many of the plugins are not updated
    and still use the old (slower) code.

    PS - I fixed some smiley subcodes, now there should be no problem when posting code

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!