ActionScript 2 load another SWF that loads other files - relative path/url problem -


few facts first:
1. can use actionscript 2.
2. files within same domain (i.e "http://www.example.com").

i have loader swf acts selection tool ("auto_magic.swf") located @ "/" in website (the root folder).
user selects tool needs (it's mechanical diagnostic system) , main movie loads (currently use loadmovie() - suggest else if needed).
tool located @ "/tools/[tools_name]/tool_main.swf".

now, "tool_main.swf" loading fine.
problem "tool_main.swf" needs load other files located in folder, example tries load "config.xml", flash isn't looking "config.xml" in tool's dedicated folder - instead it's looking file @ root folder "/" "auto_magic.swf" located, because movie's main swf coming there.

to make worst cannot modify tool's swf ("tool_main.swf") because it's coming third party.

is there solution? far see need 1 of these solutions;
1. able set base url of loaded swf.
2. *change* whole movie's base url @ run-time because needs load several tools different folders.

trying solve several hours. highly appriciated!

relative paths relative main swf exists. load chain expands, '/' refers location of main.swf.

in as2, can inspect swfs _url property determine qualified url location, , determine parent folder.

in as2 child swf, can use this:

var myfolder = this._url.slice(0, this._url.lastindexof('/') + 1); 

and use load in further assets relative itself.

hope helps.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -