Only starting from Flash 9 and Actionscript 3 we can reliably use relative path to load data. Let me explain the problem.

say for example we have an swf file named ‘Slide.swf’ in a folder ‘Slide001’ folder which loads ‘data.xml’ using the following statement

my_xml=new XML(); my_xml.onLoad=function(success){ //process the xml here } my_xml.load(‘data.xml’)

This works fine when we directly call the swf, or the html page that embeds the swf stays in the same folder.

But if you load the swf(‘Slide.swf’) inside another swf which resides in the parent folder, ‘data.xml’ is expected at the parent folder instead of ‘Slide001’

Same happens when we move the html to parent folder. The prototype I’ve given below, which finds the path of the current swf can solve this problem.

MovieClip.prototype.addProperty(‘path’, function () { if (this._path == undefined) { var a = this._url.split(‘/’); a.pop(); this._path = a.join(‘/’)+’/’; } return this._path; }, null);

Once you have the above prototype change the xml.load statement as shown below

my_xml=new XML(); my_xml.onLoad=function(success){ //process the xml here } my_xml.load(this.path+’data.xml’)