Sie sind nicht angemeldet.

Lieber Besucher, herzlich willkommen bei: krpano.com Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

mds

Fortgeschrittener

  • »mds« ist der Autor dieses Themas

Beiträge: 152

Wohnort: Athens, GA

Beruf: Designer

  • Nachricht senden

1

Freitag, 13. Mai 2011, 19:09

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

Quellcode

1
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.

Quellcode

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



Much thanks!
*thumbsup*
Say "Hi!" on twitter

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

2

Freitag, 13. Mai 2011, 19:59

did u try


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

?

Tuur *thumbsup*

mds

Fortgeschrittener

  • »mds« ist der Autor dieses Themas

Beiträge: 152

Wohnort: Athens, GA

Beruf: Designer

  • Nachricht senden

3

Freitag, 13. Mai 2011, 20:01

did u try


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

?


that throws this error: 1180: Call to a possibly undefined method get.

*confused*
Say "Hi!" on twitter

mds

Fortgeschrittener

  • »mds« ist der Autor dieses Themas

Beiträge: 152

Wohnort: Athens, GA

Beruf: Designer

  • Nachricht senden

4

Freitag, 13. Mai 2011, 20:05

i've been stuck on this for a few days ... coming back and trying different things. i will give someone $25 USD via paypal right now if they can help me get this working. *cough* *cough* *tuur* *cough*

*thumbup*
Say "Hi!" on twitter

5

Freitag, 13. Mai 2011, 20:22

you have to put a new var

var xmlLoader:URLLoader;

xmlLoader.load(xmlUrl);

mds

Fortgeschrittener

  • »mds« ist der Autor dieses Themas

Beiträge: 152

Wohnort: Athens, GA

Beruf: Designer

  • Nachricht senden

6

Freitag, 13. Mai 2011, 20:26

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:

Quellcode

1
2
3
4
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.
Say "Hi!" on twitter

7

Freitag, 13. Mai 2011, 20:35

Try to reload krpano

krpano_load();

or the mane of your swf

tour_load();

8

Freitag, 13. Mai 2011, 20:38

Quellcode

1
2
3
4
5
6
7
function krpano_load():void
{
	var krpanoloader = new Loader();
	krpanoloader.contentLoaderInfo.addEventListener(Event.COMPLETE, krpano_load_complete); 
	krpanoloader.load(new URLRequest("tour.swf"));
}
krpano_load();

mds

Fortgeschrittener

  • »mds« ist der Autor dieses Themas

Beiträge: 152

Wohnort: Athens, GA

Beruf: Designer

  • Nachricht senden

9

Freitag, 13. Mai 2011, 20:43

hmm, still nothing
*sad*
Say "Hi!" on twitter

mds

Fortgeschrittener

  • »mds« ist der Autor dieses Themas

Beiträge: 152

Wohnort: Athens, GA

Beruf: Designer

  • Nachricht senden

10

Freitag, 13. Mai 2011, 23:02

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?

Quellcode

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


*confused*
Say "Hi!" on twitter

mds

Fortgeschrittener

  • »mds« ist der Autor dieses Themas

Beiträge: 152

Wohnort: Athens, GA

Beruf: Designer

  • Nachricht senden

11

Samstag, 14. Mai 2011, 08:22

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

Quellcode

1
2
3
4
5
<plugin 
name="myPlugin"
url="myPlugin.swf"
xmlpath="gallery.xml"
/>


AS3

Quellcode

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



Not what I was hoping for but hey, it works! *thumbup*
Say "Hi!" on twitter

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

12

Sonntag, 15. Mai 2011, 00:49

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:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import krpano_as3_interface;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;

var krpano        : krpano_as3_interface = null;

if (stage == null)
{
	// plugin startup
	addEventListener(Event.ADDED_TO_STAGE,     startplugin);
	addEventListener(Event.REMOVED_FROM_STAGE, stopplugin);
}

function startplugin(event:Event):void
{
	// now start
	krpano = krpano_as3_interface.getInstance();
	var xml_url:String = krpano.get('xml.url');	
	krpano.call("trace("+xml_url+")");
	krpano.call("trace(get(xml.content))");
	var xmlrequest:URLRequest = new URLRequest(xml_url);
	var loader:Loader = new Loader();
	loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
	
	loader.load(xmlrequest);
}
function stopplugin(event:Event):void
{
	// remove plugins events
	krpano = null;
} 
function loadComplete(evt:Event):void {

	var xml:XML = new XML(evt.target.data);

    krpano.call("trace("+xml+")");
}

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

13

Sonntag, 15. Mai 2011, 00:54

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.

mds

Fortgeschrittener

  • »mds« ist der Autor dieses Themas

Beiträge: 152

Wohnort: Athens, GA

Beruf: Designer

  • Nachricht senden

14

Sonntag, 15. Mai 2011, 22:35

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*
Say "Hi!" on twitter