newstandard
asked on
Loading external swf and setting its relative path
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/pro gram.swf
/myContent/someProgram/aud io/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
/flashViewer.swf
/myContent/someProgram/pro
/myContent/someProgram/aud
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
var request:URLRequest = new URLRequest(movieSrc);
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onComplete);
loader.load(request);
stage.addChild(loader);
ASKER
That would work, except the audio files have the same name for each swf. I would move the swf's that Iam trying to load, but the point of me creating the viewer is to try and make them hidden, as we are trying to secure them as much as we can.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
When you load any *.swf into another *.swf, it's URL changed to that one of the parent, in this case, the root directory. The easiest thing to do in this kind of scenarios is to move them, so you end up with something like this:
/flashViewer.swf
/audio/sound1.wav
/myContent/someProgram/pro
-V