If the images are in the same dir as the xml, I would think that you
could just add it to your image path when you store the path of the
image in your image var (image[i]).

// something like this:
image[i] = tripPath +
xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Corey
Knafelz
Sent: Wednesday, June 07, 2006 3:06 PM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] flashvars, SWFObject, paths & XML

I'm working on a XML slideshow application:
http://fuzzylogical.com/clients/rei/slideshow/v5/ss_swfObject.html

Using SWFObject, I'm easily able to pass the variable tripPath to the
swf using flashvars.

<script type="text/javascript">
                // <![CDATA[
                
                var so = new SWFObject("xml_photogallery_5.swf",
"sotester", "570",
"455", "7", "#FFFFFF");
                so.addVariable("tripPath", "foo");
                so.write("flashcontent");
                
                // ]]>
</script>

I then use tripPath to append the directory where slideshow.xml lives
(foo) using the following code:

//-- Load XML --//
function loadXML(loaded) {
        if (loaded) {
                xmlNode = this.firstChild;
                image = [];
                imagetitle = [];
                description = [];
                thumbnail = [];
                total = xmlNode.childNodes.length;
                for (i=0; i<total; i++) {
                        image[i] =
xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
                        imagetitle[i] =
xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
                        description[i] =
xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
                        thumbnail[i] =
tripPath+xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
                }
                firstImage();
        } else {
                content = "file not loaded!";
        }
}

xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(tripPath+"/slideshow.xml");

The problem I'm having is since I'm describing a relative path in the
xml file, for example: <image>gal_00.jpg</image>, I'm unable to have
the images reside in the same directory as the xml file. They have to
be relative to the slideshow swf in order to load.

Can anyone offer any thoughts on how I might concatenate tripPath to
the beginning of the path of <image> described in the xml file?
http://fuzzylogical.com/clients/rei/slideshow/v5/foo/slideshow.xml

Thanks in advance,
Corey
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to