Q:

I have a xml file with code in it and i need to integrate that code in as3.  How can i do that? 

I want to add several lines of code to flash AS3.  How would i be able to do that if those lines are in a xml and the data that is needed is taken with a function that loads the xml. 
I need to add those lines in flash?  How can i do that? 
<? xml version="1.0" encoding="utf-8"? >

<game>

<!-- " Level id" number is not required.  Just I added it for fast calculating -->

<!--  Page 1 -->

<Level id="1" star3="6" star2="10">
<Row>2,2,2,2</Row>
<Row>2,2,0,0</Row>
<Row>2,2,2,2</Row>
<Row>1,1,4,4</Row>
<Row>1,1,4,4</Row>
</Level>

<Level id="2" star3="8" star2="12">
<Row>2,2,2,2</Row>
<Row>2,2,2,2</Row>
<Row>0,1,1,0</Row>
<Row>3,3,4,4</Row>
<Row>3,3,4,4</Row>
</Level>

<Level id="3" star3="8" star2="12">
<Row>1,0,1,1</Row>
<Row>1,0,1,1</Row>
<Row>1,1,4,4</Row>
<Row>1,1,4,4</Row>
<Row>1,1,1,1</Row>
</Level>

<Level id="4" star3="8" star2="12">
<Row>3,1,1,0</Row>
<Row>3,1,1,0</Row>
<Row>2,2,2,2</Row>
<Row>3,3,4,4</Row>
<Row>3,3,4,4</Row>
</Level>
. 
. 
. 
etc

The function to load this xml is the following one:
//playBtn.visible=false;
loadXML();
//loading data from the xml file. 
function loadXML():void {
var loader:URLLoader=new URLLoader();
loader.addEventListener(Event. COMPLETE,completeXMLHandler);
//defining request.; 
var request:URLRequest = new URLRequest("data.xml");
//try catch any error
try {
    loader.load(request);
} catch (error:Error) {
    trace('error');
}
}

//loading function
function completeXMLHandler(event:Event):void {

var loader:URLLoader = URLLoader(event.target);
var result:XML = new XML(loader.data);
//defining new xml document
var myXML:XMLDocument=new XMLDocument();
myXML.ignoreWhite = true;
myXML.parseXML(result.toXMLString());
//defining node;
var node:XMLNode = myXML.firstChild;
//defining levelNum from the lenght of the node
totalLevel = int(node.childNodes.length);
//pushing the words and their clues to the array
//creating a temporary array for each level, than pushing temporary array to the main array (dataArray)
for (var i:int=0; i<totalLevel; i++) {
    scoreArray.push(9999)
    var temp_array:Array=new Array();
    var row:int = int(node.childNodes[i].childNodes.length);
        starInfoArray.push(node.childNodes[i].attributes.star3+"_"+node.childNodes[i].attributes.star2);
    for (var j:int=0; j<row; j++) {
        var myData = node.childNodes[i].childNodes[j].firstChild.nodeValue;
        temp_array.push(myData);
    }
    dataArray.push(temp_array);
}
}

Please tell me if you need more details. 

A:

You can embed the xml into your existing actionscript 3 code and access it straight away. 
Here's what I mean:
var gameXML:XML = <game>
    <Level id="1" star3="6" star2="10">
        <Row>2,2,2,2</Row>
        <Row>2,2,0,0</Row>
        <Row>2,2,2,2</Row>
        <Row>1,1,4,4</Row>
        <Row>1,1,4,4</Row>
    </Level>
    <Level id="2" star3="8" star2="12">
        <Row>2,2,2,2</Row>
        <Row>2,2,2,2</Row>
        <Row>0,1,1,0</Row>
        <Row>3,3,4,4</Row>
        <Row>3,3,4,4</Row>
    </Level>
    <Level id="3" star3="8" star2="12">
        <Row>1,0,1,1</Row>
        <Row>1,0,1,1</Row>
        <Row>1,1,4,4</Row>
        <Row>1,1,4,4</Row>
        <Row>1,1,1,1</Row>
    </Level>
    <Level id="4" star3="8" star2="12">
        <Row>3,1,1,0</Row>
        <Row>3,1,1,0</Row>
        <Row>2,2,2,2</Row>
        <Row>3,3,4,4</Row>
        <Row>3,3,4,4</Row>
    </Level>
</game>;

//traverse the game config xml
for each(var level:XML in gameXML.Level.*){//go through each Leve node in the XML
    scoreArray.push(9999);
    starInfoArray.push(level.@star3+"_"+level.@star2);//access the start3 and start2 attributes
    var temp_array:Array = [];
    for each(var row:XML in level. Row.*)  //go through each Row node in a Level and get the data 
        temp_array.push(row.text().toXMLString());//you might want to parse these strings at some point and get the int values
    dataArray.push(temp_array);
}

Note that the XML tags might need formatting if you get syntax errors (can't test the code at the moment)

