Topic: Loading viewer from second level folder

From the root directory I am calling in 3 separate viewer.swf files from second level directories etc. "necklaces/viewer.swf" I have no poblem doing that but the gallery.xml file is always being called in from root instead of necklaces/gallery.xml. Where can I set the gallery.xml path if I am calling in the viewer.swf movie into another Flash file.

The actionscript for the button is:

on (release) {
    _root.loadMovie("necklaces/viewer.swf", top_mc);
   }

The necklaces/viewer.swf shows up fine but then tries to load the gallery.xml file from the root instead of necklaces/gallery.xml

Thanks,
David

Re: Loading viewer from second level folder

I have the same problem and came here to see if there was an answer.
Obviously not but surely it's an easy thing to implement?

All that's needed is for one viewer.swf that can accept a path to the gallery.xml it should be using.

This would make multiple galleries very simple.

Re: Loading viewer from second level folder

I figured out how to do it. If you want me to send you the info just comtact me though the boards.

Re: Loading viewer from second level folder

Hi,

please post your solution here, so others can see it.

Thanks!

Felix Turner
SimpleViewer Support Team.

Re: Loading viewer from second level folder

All that's needed is for one viewer.swf that can accept a path to the gallery.xml it should be using.

This would make multiple galleries very simple.

It's fairly simple to set up, and really flexible. Here's how I did it:

In my main swf, I have a placeholder movieclip that I load my content swfs into. In the content swfs that contain galleries, I have another placeholder that I load viewer.swf into.

I load an initial gallery and then have a dropdown list that users can use to switch galleries. To load the initial gallery and xml file, I put an action in the first frame of the content swf:

_root._root.xmlDataPath = "(path to xml file)";
this.(placeholder movieclip).loadMovie("viewer.swf");

(Obviously you may have to change the paths to _root and viewer.swf depending on your site structure.)

Then you just need to define a function that will reload viewer.swf and overwrite the path to the root xml file on a button press or dropdown list change or what have you. So, in a simple example, you do something like this in your AS frame:

function gallerySwap(){
this.(placeholder movieclip).loadMovie("viewer.swf");

and then on your buttons:

on (press){
gallerySwap();
_root._root.xmlDataPath = "(path to new xml file");
}

Voila, when your user presses the button the viewer.swf will reload using the new xml file.

Note that your viewer.fla file needs to have the following code for this work; it should be in there already (layer 2, frame 15, line 5 in mine):

//get external XML dataPath
if (_root.xmlDataPath == undefined){
gXmlDataPath = "imageData.xml"
}else{
gXmlDataPath = _root.xmlDataPath;
}

(I think you need your viewer.swf in the same folder as your main swf for this to work, or you'll need to modify the _root path in the example above; mine are in the same folder so I didn't have to worry about it.)