# How to pass vars from XML to a document class?

**URL:** <https://forum.kirupa.com/t/how-to-pass-vars-from-xml-to-a-document-class/293714>\
**Category:** flash\
**Created:** [August 2, 2009, 9:09am UTC](https://forum.kirupa.com/t/how-to-pass-vars-from-xml-to-a-document-class/293714 "2009-08-02T09:09:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![humbucker](https://avatars.discourse-cdn.com/v4/letter/h/278dde/32.png) [@humbucker](https://forum.kirupa.com/u/humbucker)\
**Post date:** [August 2, 2009, 9:09am UTC](https://forum.kirupa.com/t/how-to-pass-vars-from-xml-to-a-document-class/293714/1 "2009-08-02T09:09:30Z")

</div>

Hi there,

I’m creating a flash project and would like to pilot the most variables (eg: colors, texts, sizes, …) from a single XML file and then spread them in my document class.

Could you tell me how to mod this ?

```auto

    public var yourName:String;
    public var myXMLLoader:URLLoader = new URLLoader();

    public function intro():void {
         myXMLLoader.load(new URLRequest("xml/config.xml"));
         myXMLLoader.addEventListener(Event.COMPLETE, processXML);
    }

    public function processXML(e:Event):void {
        var myXML:XML = new XML(e.target.data);
        yourName = myXML.@webName;
        trace (yourName); // doesnt return anything
        myXMLLoader.removeEventListener(Event.COMPLETE, processXML);
        myXMLLoader = null;
    }

```

That’s how my xml is coded :

```auto

<?xml version="1.0" encoding="utf-8"?>

    <webName>
        <![CDATA[My name...]]>
    </webName>

```

Right now I got no errors but I got nothing when tracing the “yourName” var.

I must be missing something,

Thank you sincerly,
