Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Load XML

  1. #1
    New to the CF scene
    Join Date
    Mar 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Load XML

    Hi,

    How can I load xml into my file using flashvars?

    // LOAD XML
    //
    loadXML = function (loaded) {
    if (loaded) {
    xmlNode = this.firstChild;
    total = xmlNode.childNodes.length;
    Thumb = [];
    VideoClip = [];
    Title = [];
    Copy = [];
    // Build category menu
    menu_all.header_mc.headerName.text = xmlNode.attributes.Name;
    for (n=0; n<total; n++) {
    menu_all.menu_mc.duplicateMovieClip("menu_mc"+n, n);
    menu_all["menu_mc"+n]._x = menu_all.header_mc._width+(menu_all.menu_mc._width)*n;
    menu_all["menu_mc"+n].txt_mc.categoryName.text = xmlNode.childNodes[n].attributes.Name;
    menu_all["menu_mc"+n].ID = n;
    alignObjects();
    }
    nav_mc._visible = true;
    menu_all._visible = true;
    menu_all.menu_mc._visible = false;
    buildGallery()
    } else {
    trace("Error loading XML");
    }
    };
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load("music.xml");
    stop();



    I tried this, and it doesn't work for me.

    xmlData.load (this.myFile);

    Thanks in advance.

  • #2
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    flashvars is just a variable that you can set in HTML that is available in flash. Look at my signature for a post about embedding flash where you can send that variable, and then just use the variable name inside of flash.

    A good XML tutorial in Flash

    http://www.kirupa.com/web/xml/index.htm
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.


  •  

    Posting Permissions

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