Topic: Sourcing XML data from other scripts


I am trying to create a gallery where visitors can use selection criteria to get a set of images.  The thumbnails and images shouldn't be moved on the fly, so I'll have to have them all in the same subdirectories.

That's OK, but what I need is to have the XMLDATAPATH XML created on the fly based on their query.  I can do that, too.

I see the XMLDATAPATH script option, but I note that's PHP.  Am I right to assume that Flash is executing the PHP script inside the player and that can't be done with Microsoft languages?

Is it possible to use another (especially VB.NET) script to create the XML data, or a local variable full of XML, or perhaps call out to the webservice via a URL or do I need to create a session specific text file and feed that name into the script?

Either way, the actual XML has to be created on the fly after the selection criteria is complete.

Looking for a recommendation on the best approach (since I don't know squat about Flash and don't have time to learn for this project).


p.s. Great product and I bought the source even though I don't have any plans to modify it.  :-)

Re: Sourcing XML data from other scripts

SimpleViewer loads an external XML file when it runs. This XML file can be dynamically generated via whatever method you prefer.

Check here, there are 2 ASP scripts that will generate the XML file required by SimpleViewer: … truct.html

Felix Turner
SimpleViewer Support Team.

Re: Sourcing XML data from other scripts

Wow, thanks for the fast reply.

Actually, since there could be lots of visitors looking at the photo gallery at the same time, and since they could each have a different selection criteria, I can't use a single XML file that is statically generated by me in advance.  I'll need to generate the XML file on the fly and it'll have to be unique to that request at that moment.

I am planning to create the thumbnails from the images and leave them all in one subdirectory.  The XMLDATAPATH file would contain only the photos that were requested by the selection criteria.

It looked to me like the sample PHP script was being executed *inside* Flash and generating the file that way.

I was hoping I could just put a URL in there that called a webservice that return an XML string, but doesn't sound like it.

If all else fails, I might be able to create an XML file with a GUID for a filename, then pass that to the script.  I just didn't want to bother with the cleanup if I could avoid it.

Does this make a bit more sense now?


Actually, what I'd like to do is this

fo.addVariable("xmlDataPath", "http://mysite/mywebservice/getphotos.asmx");

But that can't work, right?

Thanks again.

Re: Sourcing XML data from other scripts

Actually, what I'd like to do is this

fo.addVariable("xmlDataPath", "http://mysite/mywebservice/getphotos.asmx");

But that can't work, right?

Why won't it work? Did you try it?

Felix Turner
SimpleViewer Support Team.

Re: Sourcing XML data from other scripts

Yes, but I most certainly klutzed it up as I was in a hurry to try it and wasn't very thorough.

I've gone back to the drawing board on creating the xml strings, but I assumed the script was executing *inside* flash, and not fed from another site.

This is my ignorance of flash showing.

I have reached that part of the project where I'll be trying to make this work in the 48 hours or so, so I'll let you know.


Re: Sourcing XML data from other scripts

hmm i am interested in seeing that method working. All I am doing right now is call an XML directly from that line, but using aspx or other method, what advantages are there?


Simple Viewer FAQ By Kevin

Re: Sourcing XML data from other scripts

'm trying to create galleries on the fly based on selection criteria the user specifies.

From hundreds of pictures, I want to select the data from a database, turn it into an XML stream on the fly and then feed it to flash.

Doing it from a stream allows me to avoid creating an XML file which I would have to delete after the viewing was finished.

For a fixed gallery, the current method is quite good.  I just don't have a fixed gallery design.

Re: Sourcing XML data from other scripts

Still struggling here.

Tried to create a Gallery class that I could use XMLSerialize on that would create the xml file directly and then return it via a webservice.  Got close, actually.

I'm a little shaky on some of this, but here's what I've discovered:

- The format of the XML file that simpleviewer wants contains some data that is applied gallery wide (title, etc) and some that is specific to each image, but doesn't really represent a "gallery" concept.

- My class had the gallery info in it just fine, but it contains a collection of images.  When XMLSerialize is called on the gallery object, it introduces an <IMAGES> tag to identify the collection of <IMAGE> tags.

- In addition, returning the xml information via webservices introduces a namepace line in resulting xml output. Apparently this is required.  I can't seem to get rid of it without doing a whole lot more processing on this file.

Simpleviewer seems to choke on anything in the file that conforms to XML, but that it doesn't need.

So I took my classes and gave them behavior to return the XML formatted strings and I hand built the file.

Even when I tried to return that string from a webservice, it still put XML namespace information in the string and again, SV choked on it.

At this point, it looks like I'm stuck generating a file and then deleting it after SV is finished with it.

Or getting into the flash and retrieving the XML data from a flash interface to a webservice.