A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Trying to open a xml from a swf that is opened from another xml in a different loc.

  1. #1
    Member
    Join Date
    Dec 2007
    Posts
    62

    Trying to open a xml from a swf that is opened from another xml in a different loc.

    OK so this might sound confusing. I have a swf(A) that loads another swf (B)from a xml(A) file. Then in swf(B) I have another xml(B) that loads information into swf(B). the problem is it looks like when swf(A) loads swf(B) it is looking for xml(B) in xml(A)'s location. Is there a way to get xml(B) to work from its location without moving it to xml(A)s location?

  2. #2
    AS3 Mod
    Join Date
    Sep 2007
    Location
    O-H-I-O
    Posts
    2,385
    In swf(B) place this code at the top of your actionscript:

    PHP Code:
    this._lockroot true
    Let me know if that helps.

  3. #3
    Member
    Join Date
    Dec 2007
    Posts
    62
    Nope still giving same error, do I need to put that on swf(A)?

  4. #4

  5. #5
    Member
    Join Date
    Dec 2007
    Posts
    62
    But your xml and swf files are in the same folder. My folder structure is set up like this
    FOLDER(A) contains SWF(A), XML(A), FOLDER(B)
    FOLDER(B) contains FOLDER(C)
    FOLDER(C) contains SWF(B), XML(B)

    in essence this is a gallery inside of a gallery. SWF(A) shows a slideshow of houses. when you click on a house it pops up another gallery; SWF(B) which is another slideshow of images of that house. I could make the xml for SWF(B) be: "FOLDER(B)/FOLDER(C)/XML(B).xml" the problem is then none of the paths in XML(B) are right, they then all need to follow the same folder structure. Am I making this to hard on myself? should I just move the SWFs and XMLs up to the same folder?

  6. #6
    AS3 Mod
    Join Date
    Sep 2007
    Location
    O-H-I-O
    Posts
    2,385
    I think if you read about relative and absolute paths you should be able to understand why it's not working. Here is an example mirroring your structure.

  7. #7
    Member
    Join Date
    Feb 2006
    Location
    Johannesburg, South Africa
    Posts
    41
    Its because you are not pathing to the XML correctly. Create one swf that pulls in swf(a), swf(b) etc in each one of these swfs create a path to the specific xml like so.

    var A_xml = new XML();
    A_xml.load("folderA/A.xml");
    A_xml.onLoad = function (success)
    {
    trace(success A)
    }


    I then created a swf in the same parent folder where folderA, folderB etc are located. Inside of this new swf I placed the following code.

    loadMovie("folderA/A.swf",this)

    It displays the trace(successA) from the A.swf written above. by changing the loadMovie to this:

    loadMovie("folderB/B.swf",this)

    you will load the B.swf with its xml intact provided you used the code above but with the A changed to B like so:


    var B_xml = new XML();
    B_xml.load("folderB/B.xml");
    B_xml.onLoad = function (success)
    {
    trace(success B)
    }

    This works for me, hope that it helps.
    Last edited by vyfster; 10-06-2008 at 04:42 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center