Using the pathToFiles variable
We’ve been asked many times how to use our files with a different folder structure that what we provide on Flabell. I thought this article will help you understand how our components work.
Let’s use this folder structure as an example:
The folder we’re interested in is the deploy folder. Here are all the files you need to deploy to your server for the component to work. The other folders are source files used to create the product.
1. First, there’s a variable defined in the FlashVars (index.html) called pathToFiles. This variable holds the path to the folder containing all the files (it’s in the same folder with the index.html, the swf and the js folder). In this example, the pathToFiles folder is accordion/, and it contains the folders xml and content.
You can set the pathToFiles variable to “” if you want to use absolute paths, or if you want to set the entire path to the folders, as the relative path (the normal way to do it). Note if you set the variable to the empty string, you must make sure the XML file that holds the path to the images, has the correct paths to it’s content, relative to the HTML file that loads the swf, not to the path where the XML is.
2. Secondly, there’s another variable defined in the FlashVars (index.html), called settingsPath, where we define the path to the settings XML file. Note the accordion folder isn’t passed anymore in front of it, since the pathToFiles contains the path to that folder.
Example:
flashvars.pathToFiles = “accordion/”;
flashvars.settingsPath = “xml/accordion.xml”;
Make sure you check the image at the top to understand how things are passed to the preview.swf file.
So when we read the XML path, we read it like this:
pathToFiles + settingsPath = accordion/xml/accordion.xml
And when we read an image from the XML, which in this case is defined like this content/images/image1.png we add the pathToFiles in front of it. So the path will be like this:
pathToFiles + xmlNode = accordion/content/images/image1.png
3. Another thing to keep in mind is that if you want to use absolute paths for your images, you must set the pathToFiles variable to the empty string, so that it doesn’t add up to the absolute paths. Or you can define the website address on it if you want to, and not pass it in the XML file anymore.
So if you want to take the image from http://www.vuzum.com/images/image1.jpg, and the xml from http://www.vuzum.com/accordion.xml the path needs to be like this:
flashvars.pathToFiles = “”;
flashvars.settingsPath = “http://www.vuzum.com/accordion.xml “;
While in the XML, the path to the image would be like this:
http://www.vuzum.com/images/image1.jpg
So when the product reads the paths, it receives the following:
XML PATH: pathToFiles + settingsPath = “” + http://www.vuzum.com/accordion.xml = http://www.vuzum.com/accordion.xml
IMAGE PATH: pathToFiles + xmlNode = “” + http://www.vuzum.com/images/image1.jpg
pathToFiles can be empty if you want to use the component as you use other Flash files. We consider it useful, but it’s your decision.
I hope this makes sense!
This post has 24 comments | Post your comment
Emanuel
November 3, 2009 at 5:10 am
How can i read the XML from the bottom to the top ? My gallery shows the first path on the XML and when i add one with php, this go to the bottom, so the new image is the last image.
Sorry my english.
gerardo
November 18, 2009 at 10:57 pm
Since I modify the route of the deploy/index.html to domain/index.html?,
gerardo
November 18, 2009 at 11:26 pm
how change the pathfile the deploy/index.html to /domain/index.html ?????????
Dave
November 26, 2009 at 10:26 am
http://www.getmeonline.ie/fitzsimons/index.html
Hi can you help with the above link not showing images?
It works with other pages on the site such as
http://www.getmeonline.ie/fitzsimons/accomodation/index.html
I’ve tried to figure out the correct paths but i guess i am missing something.
Many Thanks
Dave
ariana
November 27, 2009 at 1:25 am
Buna,
I want to use the Timer component but I don’t find how to make the counter not refresh every time i open the page. I mean when I close the index and then reopen it, the timer to remain in real time and not reinitialize.
Or, please help me modify this:
mcTimer.init(timeLeft, pathToFiles + settingsPath, 550, 300, colorsArray, expArray, singleArray, multipleArray, distanceBetweenItems, expirationTime);
so it works in my own flash project. I copied the files and all but the rest i don’t know.
Sorry, maybe it’s better to make an “integrate the component tutorial” for each component. Not to be one general, but one specific on that component.
Otherwise very nice job!
ariana
November 27, 2009 at 2:25 am
ignore please my previus message. I will write the questions in the Countdown Timer comments place.
koObzthebuilder
December 16, 2009 at 9:20 am
HELP! i’ve gotten the image rotaotr to appear on the screen put the website adress has changed.. i now how to tpye in http://artlabmedia.com/project/deploy/index.html how do i correct this?
koObzthebuilder
December 19, 2009 at 3:57 pm
Sorry about this constant questioning but. I dont know if you’re familiar with adobe dreamweaver. If you are can you help me out a little? I inserted the swf file in the page and I did the html coding, the banner shows up in dreamweaver’s live view, but when i save it to my remote server nothing comes up. what am i doing wrong?
koObzthebuilder
December 19, 2009 at 4:00 pm
NVM i got it! Finally thankss so much for your help!
Francis
January 3, 2010 at 7:40 pm
Hi. How can I integrate this with zencart? I’m trying to use this with the main page. Does the declarations have to be inside the header or can it be within the body? Reason is I do not want to hard code it in the header file, and I want to put it in the template body. The other javascripts I have working fine this way, except for your module, which I cannot get to show.
please advice.
Sharon
February 16, 2010 at 12:36 am
I have read all of the posts and the faq section and have successfully used relative addressing but cannot get the absolute addressing to work.
I have one situation where I need to use absolute addresses. Could we have an example of a deployment using absolute addresses?
I don’t get this one at all.
I have the .html file outside the deploy folder in the main root and I’m trying to find any combination possible to connect it to the movie but no use. What can be done here?
Sure this is something very small I’m missing, but what?
Dedo
February 25, 2010 at 10:18 am
This doesn’t work. This should be very simple, not sure what’s going wrong here.
I read the Safari article but no use. I can’t find an example code of it anywhere.
This is the page:
http://www.sumatrafilms.com/danika-trailer.asp
Could someone tell me what I’m missing here?

blog entries
Gavin
November 1, 2009 at 5:30 pm
Regarding the xmlNode for the image path: Is it possible to embed the xml as a ‘data island’ in the index.html file?
Since the xml file contains such a small amount of information, it would be great to simply include this in the html file that reads the xml information for the program to work…I am specifically referring to the Magnify product, but this is probably true for all of them?