all groups > flash actionscript > december 2005 >
You're in the

flash actionscript

group:

Movies that weren't meant to work together...


Movies that weren't meant to work together... bnailWedge
12/17/2005 11:19:35 PM
flash actionscript:
This one is a bit complicated to explain, but here it goes.

The setup:
I am building a portfolio site to house all of my Flash work from the last
seven years. Much of this work consists of Flash sites that load in their own
movies and files; thus resulting in a lot of work spanning a lot of directories
and sub directories. My portfolio site now acts as the root file, in the root
directory, and I want all of my work to play through it. All of the path names
are dynamically generated from a database using remoting functions.

The directory looks something like this:

root ---(where the portfolio.swf is)
root/published work/client1/project1.swf ---(->loaded by main.swf)
root/published work/client1/project1files/loadedFile1.swf ---(->loaded by
project1.swf)
root/published work/client1/project1files/loadedFile2.swf ---(->loaded by
project1.swf)
root/published work/client2/project2.swf ---(->loaded by main.swf)
root/published work/client2/project2files/loadedFile1.swf ---(->loaded by
project2.swf)
root/published work/client2/project2files/loadedFile2.swf ---(->loaded by
project2.swf)

The result:
The main files for the individual portfolio pieces pull up fine (project1.swf
and project2.swf). Their loaded content does not (loadedFile*.swf). The
loaded content files (loadedFile*.swf) are trying to load out of the root
directory instead of their respective client project folders. I know it is
doing this because the output window in flash tells me that the "sub" loaded
files are using the folder that the root (portfolio.swf) is in as their
starting point. I need them to recognize that the proper place to pull from is
what is relative to the location of the folder of the project.swf files, not
the root portfolio.swf file.

Here is the error I get when testing locally:
Error opening URL "file:///root/loadedFile1.swf"

Here is where the file is actually located:
"file:///root/published work/client1/project1files/loadedFile1.swf"

To complicate matters:
The main file has to load in its' own files to operate properly; -such as .css
files and such. Therefore, altering the BASE tag is not very productive.
Besides, there are many projects in many directories and sub directories. If I
alter the BASE tag, my .css won't load and neither will any of the other
projects.

Also,...I am using _lockroot on the MC that houses the loaded project files.
It seems to be working fine for variables and such, but it has no effect it
seems on the directory structure that is needed.

All of it seems to working properly EXCEPT for the directory paths getting
screwed up on the sub loaded files. My temporary fix was to put in a "LAUNCH"
button while I work on the rest of the site. It calls an index.php file that
has a variable BASE tag and it loads up the projects just fine. However, it
kind of sucks that I cannot do this in the Flash file, but instead have to
leave Flash to accomplish this. What would be ideal is that the user never has
to leave the main page to view work that is a bit more complicated (in terms of
extra loaded files).

If you want to see what I am talking about in action, go to:
http://www.exade.com/p3 (It isn't finished yet so some links and buttons
aren't functional. There is enough done on it to demonstrate this issue
though.)

Click on the "featured item" that is labeled "POWER TO THE PEOPLE." It is one
of the projects that has a lot of files that have to be loaded in. As you will
see, only the main file will load up; -nothing else will. Then hit the
"LAUNCH" button and see that it does work, just not in my main file.

What is needed is to somehow dynamically change the BASE tag ONLY inside of
the project MC that is loaded into the root .swf. Does anyone know how to
resolve this? I have scoured the net with no luck.
Re: Movies that weren't meant to work together... bnailWedge
12/21/2005 6:37:45 PM
Re: Movies that weren't meant to work together... c_reed
12/22/2005 12:31:55 AM
breaking up the url path gives you where you are in the scheme of things and
not keeping you in the root path. Try this.

var filePath:String
var url_array:Array

function getFilePath() {
url_array = this._url.split("\\");
if (url_array.length == 1) {
url_array = this._url.split("/");
}
url_array.pop();
filePath = url_array.join("/");
}


getFilePath();
//this sets a variable filePath to the full path name of the file you are in
then you can add just the file name as the first one below or more directory
structure as deep as needed like the second one
.
loadMovie(filePath + "/filename.swf",movie);

loadMovie(filePath + "/deeperDirectory/filename.swf",movie);
AddThis Social Bookmark Button