views:

192

answers:

1

I want to load a preloader (call it "target app") into my own Flash application (call it "hosting app") via Loader. The target app loads like a typical preloader several other SWF files via relative paths and starts the target app.

If the hosting app and the target app are residing in the same directory everything works fine. If the opposite is the case (target app not in the same directory as hosting app) the target app is not able to find the SWF files it has to load.

Is there a way to tell the target app it should use its own directory as working directory?

A: 

Relative URLs are resolved in relation to the first swf on the VM.

In order to change that, you'd have two options: 1. use loaderInfor.url on the target app, and concatenate other URLS from that base path. 2. Set the "base" parameters on the loaderInfo (before the swf finishes loading, just after init). I am not sure this works on a loaded swf (it should, in principle)

This way, you can be sure that all URLs are resolved relative to the target swf.

Cheers

Arthur Debert
Thanks for the reply. I am sorry to say that the first option is not applicable because we have no source code of the legacy application (the target app). I tried the second method (setting the base parameter) via the URL but it does not work either :/ Do you have other suggestions?
natorion
Nope, not really, sorry ;) (but I do think there must be a way.The second option (base parameter), should be set in code, not on the URL, is that what you've tried?
Arthur Debert
I tried setting it directly too but the parameters property is read only :/
natorion