Topic: XMLPath

If I try to specifiy a XML file other then gallerydata.xml autoviewer wont load the images. BUT if I renamed 4.xml to gallerydata.xml everything works.

JS:
Same +

fo.addParam("XMLPath", "4.xml");

4.xml file

<?xml version="1.0" encoding="UTF-8"?>
<gallery title="Example Title" frameColor="0xFFFFFF" frameWidth="10" imagePadding="0" displayTime="6">
<image>
   <filename>kprs0001.jpg</filename>
   <caption>File One</caption>
   <width>355</width>
   <height>148</height>
</image>
<image>
   <filename>kprs0002.jpg</filename>
   <caption>File 2</caption>
   <width>355</width>
   <height>148</height>
</image>
</gallery>

Re: XMLPath

Autoviewer doesnt support the XMLPath variable as a flash param. If you have the source code, you can set the XML path in options.as

Felix Turner
SimpleViewer Support Team.

Re: XMLPath

Autoviewer doesnt support the XMLPath variable as a flash param. If you have the source code, you can set the XML path in options.as

Well it really should IMHO !

Its a bit annoying that I have to boot windows, start up Flash, edit a file, build the flash movie only to change something as simple as this.

I *really* hope you can find the time to make this configurable as a flash param. It would make this purchase worth the $45.

Pål O.
Norway.

Re: XMLPath

This really hurts the usefulness of the script.

Re: XMLPath

Well, it doesn't support as a flash param, but there is a solution - I used mod-rewrite on my apache server, to use other xml-s.

Moreover, I managed to use only one central flash for all of my galleries with this trick.

http://totesz.sch.bme.hu/_kepek/

This page is in Hungarian but I guess you can use it. The xml generation is almost the same as the 'Autoviewer automatic PHP script', but the path is fake.
So, there are no xml-s, a script makes it on the fly, which takes the gallery's name from the path. Then the flash tries to get the pictures, which are not in the images folder, but a line in .htaccess and everything is solved.

I've got some problem with refreshing but I don't have time right now to solve it.

If you're curious about the .htaccess or the php scripts, I could write about them here, just reply me.

Re: XMLPath

Oh, one more thing - my server is online only at weekdays and during the day. (Sometimes on weekends and even at night but it's rare.)

Re: XMLPath

I am a little bit disappointed that Autoviewer doesnt support the XMLPath variable as a flash param. This is what I thought would be possible, reading the documentation. This is also why I bought the pro versions of simpleviewer and autoviewer.

The reason for this is, I created simpleviewer as a snippet (plugin) for MODx  http://modxcms.com/ and I wanted to do the same for autoviewer. This absolutely requires to be able to dynamically set XMLPath and imageFolderPath. The problem is, that I dont know anything about flash, so I hope you could help me to make this configurable as a flash param.

You can see my site at http://www.waso.com/ - which extensively uses simpleviewer. (Changing the .htaccess as Totesz suggested is not an option for this site.)

Re: XMLPath

Maybe I should add, that the last version of MODx content management system was downloaded more than 50.000 times. I believe a simpleviewer/autoviewer plugin for MODx would create quite some interrest in simpleviewer/autoviewer. big_smile

I believe Felix could add that feature in 10 minutes. Actually it should be easy for any experienced actionscript programmer. I already went through the source code, but I am no actionscript programmer at all. Maybe someone can offer some help.

Re: XMLPath

Well, i don't know much about flash, and don't have enough time to look through, and I can't ask you to send me the code, cause you bought it and I didn't smile, but my solution works, which I wrote above. I think you can implement the viewer into your CMS the same way, as I did on my own homepage.

Re: XMLPath

Thank you for your help, Totesz. The CMS I am using (MODx) displays every page at the root level of the website, regardless of any internal hierarchy.

Examples:
www.waso.com/98ro.html
www.waso.com/98an.html
....

Changing that would break many other things, including external links. Since the path to the xml file is relative to the page which displays the gallery, this path is always the same.

Just like you, I also have a php script instead of a hard coded xml file. Since there is always the same path, there is no way to pass the gallerys name to the php script. I tried to use the HTTP referrer inside the php script, but this does not work consistently in different browsers.

Re: XMLPath

You dont have to use path's. But I'm not sure I get hoq your CMS works. smile
You have seperated html files?  :shock:
If you can manage this then you won:
- there is a page, which contains the viewer plugin
- it gets a gallery-identifier from the query (cause you can't get it from the path)
- then this page can get the gallery, and parse it into the original page
As I see, only the original page has to be at the root level - not the gallery itself. So, there is the page, like mysite.com/gallery.html?id=gallery1, which has an internal frame, or just gets some content from the gallery-script (which can be in a lower level, and now you can use path's) - passing the id to the gallery. From this point my solution works.
Sorry if I misunderstood something I don't have much time dealing with this situation.  :oops:

Re: XMLPath

Thanks again for taking your time and your reply. I will try your solution as soon as possible.

The pages are of course php files like:

mysite.com/cms.php?id=98an

which get translated to:

mysite.com/98an.html

by an rewrite rule in the .htaccess.

Re: XMLPath

I was upset at first that PostcardViewer didn't have the same Flash variables that SimpleViewer does... but you can add them yourself fairly easily. I had to do this in order to use a custom XML file (rather than just changing the xml path and republishing the SWF).

Open source/ZoomViewer.as and add these lines inside the loadXML function:
   

//set default xmlPath
var gXmlDataPath = "imagedata.xml";
//get xml data Path from flashVars
if &#40;_root.xmlDataPath != undefined&#41;&#123;
    gXmlDataPath = _root.xmlDataPath;
&#125;    

Then, in your index file (where you call the Flash object), set the xml path:

so.addVariable&#40;"xmlDataPath", "path/to/your/xml"&#41;;

Re-publish and test...

Re: XMLPath

Any ideas how this is done with imageviewer?

Re: XMLPath

I tried this and it seemed to partially work with Autoviewer

http://www.airtightinteractive.com/foru … =6927#6927

Re: XMLPath

I implemented the solution lance_mountain described above - no problems so far. 

I'm using SWFObject instead of FlashObject to add the variable (same method name: addVariable).

You can then change the code in StageManager.as to use _root.xmlDataPath (or whatever your variable is named) instead of galleryData.xml. 

Brian

Re: XMLPath

As a happy user of SimpleViewer Pro, I decided to try AutoViewer Pro when a client asked to set up a slideshow viewer with auto-advancing images.  Now that I've purchased AV Pro, it seems that customizing it is a little different than SimpleViewer.  Do I really need to purchase Flash for $700 so I can get my $45 viewer customized?  Or perhaps spend a couple of hours trying "possible" solutions?  Please tell me it ain't so!!!!  If this is true, please point me to the refund page!

Re: XMLPath

Now that I've purchased AV Pro, it seems that customizing it is a little different than SimpleViewer. Do I really need to purchase Flash for $700 so I can get my $45 viewer customized?

AutoViewer-Pro is customized in exactly the same way as SimpleViewer-Pro, meaning that your need Flash to make modifications. As stated here:

"AutoViewer-Pro requires the Macromedia Flash 8 authoring software to customize. A free, fully functioning 30-day trial of Flash 8 can be downloaded here."

Felix Turner
SimpleViewer Support Team.

Re: XMLPath

Thanks for getting back to me Felix.

In my mind, there is a slight difference between customizing and configuring.  I do not wish to "customize" or modify the way Autoviewer works.  Especially since I don't own Flash.  I simply want to be able to configure it by choosing an xml file and image directory for a gallery.  Since this is pretty easy in SimpleViewer, I assumed AutoViewer would be similar.  I guess that was my mistake.

So if your statement is true...

AutoViewer-Pro is customized in exactly the same way as SimpleViewer-Pro

Can I do the following with Autoviewer?
fo.addVariable("xmlDataPath", "galleries/gallery.php?id=21")

...and can I specify this in the XML file?
imagePath="/gallery_21/"

If this can be done, please let me know. Perhaps I've overlooked something.  If not, then they are NOT configured in the same way.

I just want to configure some options on the fly instead of having to republish a viewer.swf for each gallery.  Apparently others are having the same problem:

viewtopic.php?t=4722
viewtopic.php?t=4413
viewtopic.php?t=170
viewtopic.php?t=4055
(sorry...couldn't post URLs in the forum)

In that last one...in your own words:

Autoviewer is not setup to accept the 'xmlDataPath' variable in the same way as SimpleViewer. The reccomended way to set the xmlDataPath for autoviewer is to set the 'XMLPath' AS option, then republish your swf.

Admittedly this is not as convenient as setting the xmlDataPath in the HTML embed code. If you want to have AutoViewer read in the xmlDataPath from the HTML embed code, make the following change in XMLManager.as.

Unfortunately, I found all this out AFTER I purchased Autoviewer.  My bad...I should have researched it better.  I'll just have to find another solution.  Thanks anyhow.

sad

Re: XMLPath

Thanks for your tip.

Re: XMLPath

If you want use AutoViewer like SimpleViewer you MUST edit the file XMLManager.as and at line 47, modify the function loadXML

Original function loadXML:

    public function loadXML&#40;&#41;&#58;Void&#123;                                
        xmlResults.load&#40;Options.XMLPath&#41;;                
    &#125;    

New function loadXML:

    public function loadXML&#40;&#41;&#58;Void&#123;                                
        // Get xml data Path from flashVars or from Options.as
        if &#40;_root.xmlDataPath != undefined&#41; xmlResults.load&#40;_root.xmlDataPath&#41;;
        else xmlResults.load&#40;Options.XMLPath&#41;;                
    &#125;    

Dont forgot to open autoviewer.fla and click on File-> Publish to create the new viewer.swf in the folder deliver

Now if you specify the parameter xmlDataPath y your flash object (HTML) you will change the xml path. If you dont specify this parameter AutoViewer will search for gallerydata.xml

You must use with something like this (in the HTML):

    <script type="text/javascript">
        var fo = new FlashObject&#40;"viewer.swf", "viewer", "100%", "100%", "8", "#181818"&#41;;        
        fo.addParam&#40;"scale", "noscale"&#41;;
        fo.addVariable&#40;"xmlDataPath", "myownXML.xml"&#41;;
        fo.write&#40;"flashcontent"&#41;;    
    </script>    

It works !!!

Re: XMLPath

And now, if you also want to change the image directory.

You must edit the XMLManager.as, the function loadXML() on line 47

You must add the line

        if &#40;_root.imageFolderPath != undefined&#41; Options.imageFolderPath = _root.imageFolderPath;

Finished its like:
   

public function loadXML&#40;&#41;&#58;Void&#123;                                
        // Get xml data Path from flashVars or from Options.as
        if &#40;_root.xmlDataPath != undefined&#41; xmlResults.load&#40;_root.xmlDataPath&#41;;
        else xmlResults.load&#40;Options.XMLPath&#41;;                
        if &#40;_root.imageFolderPath != undefined&#41; Options.imageFolderPath = _root.imageFolderPath;
    &#125;    
    

Open the autoviewer.fla and File->Publish. Now you have your new viewer.swf on your deliver folder.

You must use in yours HTMLs something like this:

    <script type="text/javascript">
    var fo = new FlashObject&#40;"autoviewer/viewer.v2.swf", "viewer", "100%", "100%", "8", "#181818"&#41;;        
    fo.addParam&#40;"scale", "noscale"&#41;;
    fo.addVariable&#40;"xmlDataPath", "noticias/29/gallery.xml"&#41;;
    fo.addVariable&#40;"imageFolderPath", "noticias/29/images/"&#41;;
    fo.write&#40;"flashcontent"&#41;;    
    </script>    

Now you can modigy the imageFolderPath !!!
It works !!!

Re: XMLPath

After adapting the XMLManager.as file in the manner described above, I get syntax errors when building a new viewer.swf (File->Publish).
I am using the original Options.as file.
I don't have a clue what's going wrong.

Error code:

**Error** /apps/airtight/autoviewer/autoviewer_pro/source/com/airtightinteractive/apps/viewers/autoViewer/XMLManager.as&#58; Line 47&#58; Syntax error.
         public function loadXML&#40;&#41;&#58;Void&#123;                         

**Error** /apps/airtight/autoviewer/autoviewer_pro/source/com/airtightinteractive/apps/viewers/autoViewer/XMLManager.as&#58; Line 50&#58; Syntax error.
             else xmlResults.load&#40;Options.XMLPath&#41;;             

**Error** /apps/airtight/autoviewer/autoviewer_pro/source/com/airtightinteractive/apps/viewers/autoViewer/XMLManager.as&#58; Line 49&#58; This statement is not permitted in a class definition.
             if &#40;_root.xmlDataPath != undefined&#41; xmlResults.load&#40;_root.xmlDataPath&#41;; 

**Error** /apps/airtight/autoviewer/autoviewer_pro/source/com/airtightinteractive/apps/viewers/autoViewer/XMLManager.as&#58; Line 52&#58; ActionScript 2.0 class scripts may only define class or interface constructs.
         &#125;    

**Warning** /apps/airtight/autoviewer/autoviewer_pro/source/com/airtightinteractive/apps/viewers/autoViewer/Image.as&#58; Line 54&#58; There is no class or package with the name 'com.airtightinteractive.apps.viewers.autoViewer.XMLManager' found in package 'com.airtightinteractive.apps.viewers.autoViewer'.
             mXMLManager = XMLManager.getInstance&#40;&#41;;                

**Warning** /apps/airtight/autoviewer/autoviewer_pro/source/com/airtightinteractive/apps/viewers/autoViewer/Image.as&#58; Line 104&#58; There is no class or package with the name 'com.airtightinteractive.apps.viewers.autoViewer.XMLManager' found in package 'com.airtightinteractive.apps.viewers.autoViewer'.
                     mcCaption.mcCaption.txtCaption.htmlText = "<font size='" + Options.titleFontSize +"' "

**Warning** /apps/airtight/autoviewer/autoviewer_pro/source/com/airtightinteractive/apps/viewers/autoViewer/StageManager.as&#58; Line 48&#58; There is no class or package with the name 'com.airtightinteractive.apps.viewers.autoViewer.XMLManager' found in package 'com.airtightinteractive.apps.viewers.autoViewer'.
             mXMLManager = XMLManager.getInstance&#40;&#41;;        

Total ActionScript Errors&#58; 7      Reported Errors&#58; 7