# Xml data

**URL:** <https://forum.kirupa.com/t/xml-data/263823>\
**Category:** Uncategorized\
**Created:** [June 19, 2008, 2:37pm UTC](https://forum.kirupa.com/t/xml-data/263823 "2008-06-19T14:37:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![vxd](https://avatars.discourse-cdn.com/v4/letter/v/848f3c/32.png) [@vxd](https://forum.kirupa.com/u/vxd)\
**Post date:** [June 19, 2008, 2:37pm UTC](https://forum.kirupa.com/t/xml-data/263823/1 "2008-06-19T14:37:55Z")

</div>

Hey!

I’m trying to load text from an xml file into flash. Thats working fine only problem is I want to load all of the data into flash. Right now it’s only loading the first “node”??.

here’s the code

```auto

iArray = new Array();
my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.onLoad = function(loaded) {
    if (loaded) {
        var gallery = my_xml.firstChild.childNodes;
        for (i=0; i<gallery.length; i++) {
            var iArray = gallery*.attributes.title;
            
            myText.text = iArray;
            trace("titled "+iArray);
        }
        
    }
};
my_xml.load("test.xml");

myText.html = true;
myText.wordWrap = true;
myText.multiline = true;
myText.autoSize = true;
myText.label.condenseWhite = true;

```

here’s what’s in the xml

```php
<?xml version="1.0" encoding="UTF-8"?>

<gallery>
<image title="school: an institution for educating children : Ryder's children did not go to school at all : "/>
<image title="garden: a piece of ground, often near a house, used for growing flowers, fruit, or vegetables. "/>
<image title="shop: a building or part of a building where goods or services are sold; a store : a card shop"/>

</gallery>

```

thanks  
vxd

---

<div class="post-metadata">

**Author:** ![randomagain](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@randomagain](https://forum.kirupa.com/u/randomagain)\
**Post date:** [June 19, 2008, 2:48pm UTC](https://forum.kirupa.com/t/xml-data/263823/2 "2008-06-19T14:48:37Z")

</div>

theres tuts on this on the main page…

what is the trace statement?

---

<div class="post-metadata">

**Author:** ![vxd](https://avatars.discourse-cdn.com/v4/letter/v/848f3c/32.png) [@vxd](https://forum.kirupa.com/u/vxd)\
**Post date:** [June 19, 2008, 3:07pm UTC](https://forum.kirupa.com/t/xml-data/263823/3 "2008-06-19T15:07:49Z")

</div>

Yeah I’ve looked at that already. Didn’t explain how to show all of the information in the xml.

---

<div class="post-metadata">

**Author:** ![randomagain](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@randomagain](https://forum.kirupa.com/u/randomagain)\
**Post date:** [June 19, 2008, 3:23pm UTC](https://forum.kirupa.com/t/xml-data/263823/4 "2008-06-19T15:23:55Z")

</div>

vas? this aint rocket science

> xmlNode = this.firstChild;  
> var videos:Array = xmlNode.childNodes;  
> total = videos.length;  
> for (i=0; i\<total; i++) {

```
    videoList* = videos*.attributes.url;

```

}

get rid of the following:P

> 

myText.[COLOR=#0000ff]html[/COLOR] = [COLOR=#000000] **true** [/COLOR];

myText.[COLOR=#0000ff]autoSize[/COLOR] = [COLOR=#000000] **true** [/COLOR];  
myText.[COLOR=#000080]label[/COLOR].[COLOR=#0000ff]condenseWhite[/COLOR] = [COLOR=#000000] **true** [/COLOR];

---

<div class="post-metadata">

**Author:** ![sepu](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@sepu](https://forum.kirupa.com/u/sepu)\
**Post date:** [June 19, 2008, 3:56pm UTC](https://forum.kirupa.com/t/xml-data/263823/5 "2008-06-19T15:56:43Z")

</div>

I believe this is what you are looking for …  
ActionScript Code:  
[LEFT]my\_xml = [COLOR=#000000] **new** [/COLOR] [COLOR=#0000ff]XML[/COLOR]COLOR=#000000[/COLOR];  
my\_xml.[COLOR=#0000ff]ignoreWhite[/COLOR] = [COLOR=#000000] **true** [/COLOR];

[COLOR=#000000] **var** [/COLOR] output:[COLOR=#0000ff]String[/COLOR] = [COLOR=#ff0000]""[/COLOR];

my\_xml.[COLOR=#0000ff]onLoad[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#000000:Void[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#0000ff]if[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#000000] **var** [/COLOR] gallery = my\_xml.[COLOR=#0000ff]firstChild[/COLOR].[COLOR=#0000ff]childNodes[/COLOR];  
[COLOR=#0000ff]for[/COLOR] [COLOR=#000000]([/COLOR]i=[COLOR=#000080]0[/COLOR]; i\<gallery.[COLOR=#0000ff]length[/COLOR]; i++[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]  
output += gallery[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR].[COLOR=#0000ff]childNodes[/COLOR][COLOR=#000000][[/COLOR][COLOR=#000080]0[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000ff]firstChild[/COLOR].[COLOR=#0000ff]nodeValue[/COLOR];  
output += [COLOR=#ff0000]"[COLOR=#000099]\*\*  
**[/COLOR][COLOR=#000099]**  
\*\*[/COLOR]"[/COLOR];  
[COLOR=#808080]_//_[/COLOR]  
myText.[COLOR=#0000ff]htmlText[/COLOR] = output;  
[COLOR=#000000]}[/COLOR]

```
[COLOR=#000000]}[/COLOR]

```

[COLOR=#000000]}[/COLOR];  
my\_xml.[COLOR=#0000ff]load[/COLOR]COLOR=#000000[/COLOR];

myText.[COLOR=#0000ff]html[/COLOR] = [COLOR=#000000] **true** [/COLOR];  
myText.[COLOR=#0000ff]multiline[/COLOR] = [COLOR=#000000] **true** [/COLOR];  
myText.[COLOR=#0000ff]autoSize[/COLOR] = [COLOR=#000000] **true** [/COLOR];  
[/LEFT]

then in your XML

```auto

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

<gallery>
<image > 
    <title>school an institution for educating children : Ryder's children did not go to school at all </title>
</image>

<image > 
    <title>garden: a piece of ground, often near a house, used for growing flowers, fruit, or vegetables.</title>
</image>

<image > 
    <title>shop: a building or part of a building where goods or services are sold; a store : a card shop</title>
</image>

</gallery>

```

---

<div class="post-metadata">

**Author:** ![vxd](https://avatars.discourse-cdn.com/v4/letter/v/848f3c/32.png) [@vxd](https://forum.kirupa.com/u/vxd)\
**Post date:** [June 19, 2008, 3:59pm UTC](https://forum.kirupa.com/t/xml-data/263823/6 "2008-06-19T15:59:45Z")

</div>

Yes that what I am looking for. When I publish it say “undefined” “undefined” “undefined”

Thanks

---

<div class="post-metadata">

**Author:** ![vxd](https://avatars.discourse-cdn.com/v4/letter/v/848f3c/32.png) [@vxd](https://forum.kirupa.com/u/vxd)\
**Post date:** [June 19, 2008, 4:03pm UTC](https://forum.kirupa.com/t/xml-data/263823/7 "2008-06-19T16:03:35Z")

</div>

I got it working. Thanks a lot sepu

---

<div class="post-metadata">

**Author:** ![sepu](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@sepu](https://forum.kirupa.com/u/sepu)\
**Post date:** [June 19, 2008, 4:06pm UTC](https://forum.kirupa.com/t/xml-data/263823/8 "2008-06-19T16:06:51Z")

</div>

there you go
