AS3 Question

  • Started
  • Last post
  • 4 Responses
  • duckseason

    I'm faced with something that I've never had to deal with before and I'm not finding much online. Hopefully I can explain this well enough that it will make some sense.

    I've made a movie that loads/displays various bits of info from an XML file.
    When targeting any one XML file it works fine and everything loads/displays as it should. This is all pretty standard, and I'm not having any issues with this.

    The thing I am having a hard time wrapping my head arounf is, I need it to load XML files that are generated dynamically. So now, my one XML file named, "myfile.xml" gets populated with info and will become something like, "myfile.xml?content=xxx" or "myfile.xml?content=yyy" etc.

    If I have the AS target "myfile.xml?content=xxx" or "myfile.xml?content=yyy" specifically, it will load/display that specific content.

    How can I get so that I don't need to target one specific XML, but will have the movie be able to load any XML file that gets passed its way?

    If this is confusing let me know, and I will try and elaborate further.

    Any help would be appreciated.
    Its this one thing thats preventing me from being done with this bit of the project.

  • amullins0
  • rounce0

    Is the structure of the XML files the same?

    • Structure is the same throughout - its essentially 1 xml file that gets populated with data based on which item is clickedduckseason
    • but the structure remains the sameduckseason
  • fyoucher10

    If I get what your saying, you're talking about a dynamic XML file name???

    If so, you can use a variable for the XML file name in Flash and pass the file name in as a string via Flash Vars, either through the object/embed code or SWFObject code in the HTML page or via query string.

    • Yes, dynamic file nameduckseason
    • K. If the XML file name is being generated in Flash, just use regular old variables. If...fyoucher1
    • the XML file name is being generated outside of Flash, change the name via Flash Vars...fyoucher1
    • It's being generated outside of flash. I think i'm following what you're saying. i'll give it a shot.duckseason
  • duckseason0

    How I have it setup now is:

    var filePath:String = "somexmlfile.xml";
    loader.load(new URLRequest(filePath));

    When testing locally, with just that one file, everything was fine; however, this obviously wont work for what I ultimately need it to do, as the file name changes depending on which link gets clicked and then becomes "somexmlfile.xml?content=xxx" etc.