variable retrieve from plugininterface

  • Hi Klaus,

    When retrieve a variable from the plugininterface object.

    For example, like this :

    Code
    private function registerEvent(evt:DataEvent):void
    		{
    			_plugininterface = _krpano.get(evt.data);
    			
    			_pluginterface.width 
    			_pluginterface.preload
    			...
    			
    		}

    I'd like to know, if _pluginterface.width returns a int or a String,
    if _pluginterface.preload returns a Boolean (true) or a String ("true") ... ?

    I can remember I've read on the forum that this have change lately, but can you tell us more about it for the current version ?

    Thanks !

  • Hi,

    the predefined values in krpano (visible, enable, preload, width, ...) are typed,

    e.g. "visible","enable" and "preload" are booleans,
    "width" is a string (because it can be "100" or "100%"),

    but dynamically generated variables are always strings,
    (e.g. set(plugin[anyname].myvar, true); )

    to make a check if a boolean variable is true regardless of the type and case,
    this code can be used:

    Code
    if (String(plugin.preload).toLowerCase() == "true")
    {
    ...
    }


    but it is possible to register custom varibles in as3 with correct type
    with the "registerattribute" function:

    Code
    _plugininterface.registerattribute("mybool", true);


    or:

    Code
    _plugininterface.registerattribute("myint", int(100));

    the first parameter is the name of the attribute and the second the default value,
    (if a value was already set in the xml, this value will be kept)
    the type of the given value will be also the new type of the variable,

    best regards,
    Klaus

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!