LOGIN REGISTER
Forgot password?
 
28Sep2009

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:


folder structure

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

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?

Reply

bobocel

November 2, 2009 at 4:20 am

This would be possible if you would modify the code, but we won’t make it like this for two reasons:

1. We might update the files in the future with additional settings.
2. If you want to use a product multiple times inside an HTML page, you would have to pass the same info over and over. As it is now it takes it directly from the same XML file. And that’s the only place one should modify any settings. (unless you pass different XML files to each instance of a product)

Reply

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.

Reply

Andrei Potorac

November 4, 2009 at 9:14 am

What file are you referring to? Can you post in that file’s comments?

Reply

gerardo

November 18, 2009 at 10:57 pm

Since I modify the route of the deploy/index.html to domain/index.html?,

Reply

gerardo

November 18, 2009 at 11:26 pm

how change the pathfile the deploy/index.html to /domain/index.html ?????????

Reply

Andrei Potorac

November 20, 2009 at 1:16 am

You need to move all files from the deploy, to your domain. You don’t have to do any changes.

Reply

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

Reply

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!

Reply

ariana

November 27, 2009 at 2:25 am

ignore please my previus message. I will write the questions in the Countdown Timer comments place.

Reply

Andrei Potorac

November 27, 2009 at 10:41 am

The variable pathToFiles is basically the path from the root, to the folder where the SWF is located on the website.

So, Dave, based on your links, this is how the pathToFiles variable must be defined:

pathToFiles=”ffitzsimons/accomodation/”;

For the first page:
pathToFiles=”ffitzsimons/”;

Note the pathToFiles is added in front of the images path, so make sure you don’t add it twice.

Reply

Andrei Potorac

November 27, 2009 at 10:42 am

ariana , please check the FAQ page of that component. It has the description there, step by step.

Reply

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?

Reply

bobocel

December 19, 2009 at 8:44 am

koObzthebuilder, note you didn’t use the pathToFiles variable correctly. Check the window activity inside Safari to see what the banner is trying to load, and you will understand what is to be changed.

Reply

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?

Reply

koObzthebuilder

December 19, 2009 at 4:00 pm

NVM i got it! Finally thankss so much for your help!

Reply

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.

Reply
 

Andrei Potorac

January 5, 2010 at 2:33 am

Sorry, but we’re not familiar with ZenCart.

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?

Reply
 

bobocel

February 17, 2010 at 12:39 am

In order to use absolute paths, you must set the pathToFiles to “”.

Dedo

February 24, 2010 at 6:55 pm

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?

Reply
 

bobocel

February 25, 2010 at 3:55 am

Please check in our FAQ section the article related to how you can easily debug with Safari also.

It will show you what paths you are trying to actually load.

If you set the pathToFiles variable to “”, you can use absolute paths, just like the article said.

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?

Reply

bobocel

February 26, 2010 at 12:55 am

Where exactly is the swf you try to add, and what component is it?

Reply

Leave a Reply