can i use krpano.get(xml.url); for a plugin to read same xml?

  • Developing a plugin and I want it to read in the same URL that tour.swf is using. Is this possible using a variation of the AS below? *unsure*


    AS3 - not working

    Code
    var xmlUrlReq:URLRequest   = new URLRequest(krpano.call(xml.url));


    If I use the same actionscript like this it works fine but I don't want to have it hard coded.

    Code
    var xmlUrlReq:URLRequest   = new URLRequest("tour.xml");


    Much thanks!
    *thumbsup*

  • you have to put a new var

    var xmlLoader:URLLoader;


    I've already got all the proper XML code in place (just didn't post it all)

    for example this works fine:

    Code
    var xmlUrlReq:URLRequest   = new URLRequest("tour.xml");
    var xmlUrlLoader:URLLoader = new URLLoader(xmlUrlReq);
    xmlUrlLoader.addEventListener(Event.COMPLETE, xmlComplete);
    xmlUrlLoader.addEventListener(IOErrorEvent.IO_ERROR, xmlLoadFailed);

    I just haven't been able to get the xml.url call from krpano working.

  • I've done some testing and krpano.get(xml.url); is coming up undefined for me.

    I'm loading my plugin with a hardcoded URL. And checking the "galleryPath" with a dummy text field, which is returning "undefined."

    Am i needing to register an event or something else to get xml.url to work?

    Code
    loadXml("tour.xml");
    xmltext.text = "path="+galleryPath;
    var galleryPath = krpano.get(xml.url);

    *confused*

  • Ok ... never could get xml.url to work? Would love to figure out why.

    Anyways ... I've come up with a workaround for those interested. I used a plugin attribute instead.


    XML

    Code
    <plugin 
    name="myPlugin"
    url="myPlugin.swf"
    xmlpath="gallery.xml"
    />

    AS3

    Code
    var pluginPath = krpano.get("plugin[myPlugin].xmlpath");
    var xmlUrlReq:URLRequest   = new URLRequest(galleryPath);


    Not what I was hoping for but hey, it works! *thumbup*

  • Curious, why do you want to load the url?

    I tested it in my javascript interface, and I get the url, so it works. But you can read the krpano xml with xml.content

    Loading a xml thats already loaded by krpano, is a bit of wasted resources :) Alsoo xml.url get's the url of the panorama, so if you include xml, that will not be shown. Another downside to xml.url is, you get the path which is relative to krpano.swf, which isnt the path the plugin needs to load the xml.

    So my advice, use xml.content

    Btw this is the code which works for me:

  • Alsoo I see you want a gallery, and the gallery has a seperate xml file. You could choose to create your own xml tag and put it in krpano xml.

    <krpano>
    all your krpano stuff...

    <gallery>
    your gallery.xml
    </gallery>

    </krpano>

    I think if you do krpano.get("gallery.content"); in flash, youll get the whole gallery contents (probally as string though) Look on the forum about arrays, I remember a few topics about looping the content of it.

  • Thanks for the tips Zephyr! Not sure if I actually need a separate xml file ... just playing with different options. I originally adapted an older dynamic xml thumbnail gallery of mine for krpano ... before I was more knowledgeable of krpano. That file had it's own xml reader coding and I never updated it.

    *thumbup*

Participate now!

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