How do I make swf path to image folder?

I am making external jpgs load into a movie holder.
I am running into a problem. I have the swf file that will load the external images in a swf folder. I have the jpegs I want to load in the images folder.
How do I make the actionscript 2.0 find the images folder from the swf?

var photoHolder_mc:MovieClip = createEmptyMovieClip(“photoHolder_mc”, getNextHighestDepth());
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);
mcLoader.loadClip(“images/photo1.jpg”,photoLoader_mc);
The above bolded out string is where I need the my actionscript to find the jpegs in the images folder.

I can’t remember if the path comes from where the Flash is embeded (the web page location) or where the SWF lives.

Try the link from both of them and see if you have any luck.

I imagine:

From the HTML page

mcLoader.loadClip("images/photo1.jpg",photoLoader_mc);

From the SWF

mcLoader.loadClip("../images/photo1.jpg",photoLoader_mc);

I tried it but it’s not working. :frowning: But I know this is close…

When I try to get the images folder load into a swf that is in a swf folder it won’t work.
This is the code I have:

mcLoader.loadClip(“…swf/images/photo1.jpg”,mcHolder);

This is the error I get from the decompiler:

Error opening URL ‘file:///F|/Websites%5FTo%5FFinish/NEW%5FMYNAME%5FWEBSITE/swf/…swf/images/photo1.jpg’

Might it have something to do with levels? I don’t know much about levels:

vie Clip: Frame=1 Target=“_level0.focusManager”
Button: Target=“_level0.focusManager.tabCapture”
Shape:
Movie Clip: Frame=1 Target=“_level0.focusManager.instance1”
Movie Clip: Frame=0 Target=“_level0.reserved”

I’m pretty sure it is from the .html file that is embedding it. Assuming you have a structure similar to this:

images/
swf/
index.html

Try:

mcLoader.loadClip("images/photo1.jpg",photoLoader_mc);

I’m doing something wrong. :frowning: It didn’t work.
Maybe I should be using xml? I don’t know xml.
This is so frustrating. :injured:

:x

Oh for crying out loud! IT’S WORKING NOW!!
I must have missed just a tiny part.
This was the correct path to work at least from my desktop.

	(mcLoader.loadClip("../images/photo1.jpg", mcHolder));

I will see how it works online.

Okay I get it to load from the images folder to the swf folder. However, once I get it to my server it does not load.

(mcLoader.loadClip(“…/images/photo1.jpg”, mcHolder));

Is the case correct? Sometimes that can be an issue when going from a Windows development (case in-sensitive) to a Linux deployment (case sensitive).

please HELP! I’m at my breaking point! This is my second day of trying to get this thing fixed! I actually got chest pains before and down my arm. Actionscript never gets EASIER!!

Might it be that I’m not using my root directory when I upload these files? I am using sub directories because I don’t want the website to go live yet.

I need a relative path from the images folder to a swf folder to a main swf in the html directory. So we have the following:

html
has flash embedded
intro.swf
loads another swf from a swf directory
photographs.swf
This loads a jpg from the images director.

PLEASE! I’M BEGGING YOU! HELP ME FIND THE CORRECT WAY TO WRITE THIS CODE!!
\

}
on (release) {
this.small1.small1A.yellowbox.gotoAndPlay(“pushyellow”);
this.fadeIn_mc.gotoAndPlay(“startFade”);

var mcHolder:MovieClip = createEmptyMovieClip("mcHolder", getNextHighestDepth());
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);

(mcLoader.loadClip(“mainMovie.swf/swf/images/photo1.jpg”, mcHolder));

}

Ah-ha!

This might help: for the SWF loaded in, all paths in that will be relative to it’s parent SWF.

So even though the path will be broken when the SWF is run on its own, it should work when running in the parent SWF.

The child SWF will run as though it lives in the directory of the parent SWF.

Hope that helps! :slight_smile:

Can you .zip up all the files and upload it here? How big are they?

[B]BPartch they are too big. But thanks for the offer.

I think FC is on to something with the parent child swfs… which is kind of still abstract to me.

I found out what the problem is. I have a swf called photograph.swf that loads into a swf called mainmovie.swf. I load the external jpg into the photograph.swf This is done by clicking buttons in photograph.swf. It is only when I click the buttons of photographs.swf through mainmovie.swf that it doesn’t work!!! So I think that’s the problem.

So how do I correct that issue?
[/B]

I’d say to just make sure the path in photograph.swf is pathed as though it lives in the same directory as mainmovie.swf. Because when it’s running, that’s where it thinks it is.

Two options I can give at the moment:[LIST][]get the code working in mainmovie.swf, then copy it into photograph.swf[]move all the images and SWFs to the main directory, get it working, then slowly move things to the sub directories from there, changing the paths in AS as you go.[/LIST]

[B]I ended up putting my html, swf and photo files in the same directory. Now it’s working.

I spoke too soon. It’s working but loading slow. Now I have external pngs loading instead of external jpgs. I am using drop shadows and need a transparent background.[/B]

Now for my second part of this thread.
Can I get this external jpg to have a loader or do I have to create it again with a component?

Here is the script:

on (release) {
this.small1.small1A.yellowbox.gotoAndPlay(“pushyellow”);
//this.fadeIn_mc.gotoAndPlay(“startFade”);

var mcHolder:MovieClip = createEmptyMovieClip("mcHolder", getNextHighestDepth());
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);

(mcLoader.loadClip("photo1.jpg",mcHolder));

}

http://www.republicofcode.com/tutorials/flash/moviecliploader/