Usually when you want to load a resource like an xml or picture file from an SWF file you either specify the relative path or the absolute path to the resource. The relative
path is the path that the resource is in relation to the SWF file (eg: /images/picture.jpg). The absolute path is the URL to the file (eg: http://www.yourdomain.com/rrs.xml). The relative path is often very convenient that when all the resources are placed in the same directory or in sub directories as the SWF file, then moving the whole thing dont require us to edit any path to the resources.
When embedding the SWF file in a theme or file that is loaded by other scripts, the directory of the SWF file is overridden by the directory in the main script is in. That is, if you specify a relative path to a resource from within the SWF file, its going to check for the resource from the directory where the main script is running and not from the directory in which the SWF is in. I first encountered this problem when I was developing a flash application for a WordPress theme that loads the configuration information from an XML file. All the files were places in the theme directory which were loaded by the main script.
The solution is pretty simple once you know it.
// * Get the URL of the file that loads the SWF file * //var SWF_URL:String = root.loaderInfo.url;// * Remove the name of the file that loads the SWF file thus giving the URL to the folder * //var SWF_Folder:String = SWF_URL.substr(0,SWF_URL.lastIndexOf(“/”));// * Append the Folder Url to the relative path of the file to be loaded * //ImageLoader.load(new URLRequest(SWF_Folder +”/Images/TheImageTobeLoaded.jpg “));