PDA

View Full Version : relative paths /server environment problem


akrobata79
10-11-2009, 02:58 PM
I am trying to create a flash viewer, which will load various other flash movies. The viewer will be in the root directory, but the flash movies it will load are a few directories deep. Those movies access various sound clips that are in an audio directory relative to each swf I want to load.

/flashViewer.swf
/myContent/someProgram/program.swf
/myContent/someProgram/audio/sound1.wav

It seems that when I load one of these movies into my viewer, the loaded movie is looking for the sounds in an audio folder in the root directory, and not relative to the swf I loaded. Is there a way to set this? I would rather not have to make the changes in each of my other movies to use the absolute path

code:
var request:URLRequest = new URLRequest(movieSrc);
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE,onComplete);
loader.load(request);
stage.addChild(loader);

iamthwee
10-11-2009, 03:23 PM
would it be

./myContent/someProgram/audio/sound1.wav

With an extra dot at the beginning.

henke37
10-12-2009, 02:18 PM
No, relative urls are relative to the embeding webpage, or if none exists, the first swf loaded.

Just resolve the relative urls yourself in code and pass absolute urls to the api.