defining and accessing subelements of the plugin-element

  • Hello everybody,

    I was wondering if it is possible to define and access subelements in the plugin-element.
    In the documentation there is no example and no hint. If it is possible, how do I access
    the element from the plugin (Actionscript-Code).

    Example from the docs:

    Code
    <plugin name="logo" 
    	url="krpano_logo.png" 
       align="rightbottom"  
       x="10" 
       y="10" 
    />


    I want this:

    Code
    <plugin name="logo" 
       url="krpano_logo.png" 
       align="rightbottom" 
       x="10" 
       y="10">
       <data>
     	<entry id="id_1" descr="blah"/>
     	<entry id="id_2" descr="blub"/>
       </data>
    </plugin>

    The reason is that I don't want to load an external file.

    Any idea?
    --
    Makooze

  • Hi everybody,

    seems that nobody had ever wanted to access data this way.
    I found on the other hand the <data>-element that should also work for me.
    But I just can't get it to work.

    Here is what I got so far:

    In my as3-plugin code I tried to access the data with the following line:

    Code
    var data:Object = krpano.get(data[plugin_object.data].content);
    krpano.trace(krpano_as3_interface.DEBUG,"data() - " + data);

    It does not work. Even the trace prints nothing in the krpano console.

    Thanks for your help
    Makooze

  • Hi,

    defining sub elements will work,
    but when you want to have an 'array' of elements,
    each element must have a "name" attribute as id/name/index,

    e.g. (just "name" instead your "id" attribute)

    Code
    <plugin name="logo" 
        	url="krpano_logo.png" 
           	align="rightbottom" 
           	x="10" 
           	y="10">
      <data>
    	<entry name="id_1" descr="blah"/>
    	<entry name="id_2" descr="blub"/>
      </data>
    </plugin>

    then you can access the attributes e.g. by:

    Code
    get("plugin[logo].data.entry[id_1].descr")

    best regards,
    Klaus

Participate now!

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