# Xml

**URL:** <https://forum.kirupa.com/t/xml/155806>\
**Category:** Uncategorized\
**Created:** [July 20, 2005, 12:35pm UTC](https://forum.kirupa.com/t/xml/155806 "2005-07-20T12:35:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![inzane](https://avatars.discourse-cdn.com/v4/letter/i/b38774/32.png) [@inzane](https://forum.kirupa.com/u/inzane)\
**Post date:** [July 20, 2005, 12:35pm UTC](https://forum.kirupa.com/t/xml/155806/1 "2005-07-20T12:35:17Z")

</div>

Hi all,

Does any1 know how I can fix this problem…  
See below to download the file.  
in my xml i have 2 section or records “section1” and “section2”  
each record creates a dynamic button with a label “section1” and “section2”  
my problem is how do I make it so when on press on the button it loads the section or the record

here is the XML:

> \<?xml version=“1.0”?\>  
> \<compare\>  
> \<vehicle name=“section1”\>  
> \<comment\>\<![CDATA[\<html\>  
> \<head\>  
> \<title\>Section1 title\</title\>  
> \</head\>  
> \<body\>\<br\>  
> \<p\>All info about – will be imported here\</p\>\<br\>  
> \<ul\>  
> \<li\>feature 1\</li\>  
> \<li\>feature 2\</li\>  
> \<li\>feature 3\</li\>  
> \<li\>feature 4\</li\>  
> \</ul  
> \</body\>  
> \</html\>]]\> \</comment\>  
> \<image\>images\pic1.jpg\</image\>  
> \</vehicle\>  
> \<vehicle name=“section2”\>  
> \<comment\>\<![CDATA[\<html\>  
> \<head\>  
> \<title\>Section2 title\</title\>  
> \</head\>  
> \<body\>\<br\>  
> \<p\>All info about – will be imported here\</p\>\<br\>  
> \<ul\>  
> \<li\>feature 1\</li\>  
> \<li\>feature 2\</li\>  
> \<li\>feature 3\</li\>  
> \<li\>feature 4\</li\>  
> \</ul  
> \</body\>  
> \</html\>]]\> \</comment\>  
> \<image\>images\pic2.jpg\</image\>  
> \</vehicle\>  
> \</compare\>

here is my actions

> 

//init TextArea components  
comment\_txt.multiline = true;  
//load css  
compareStyle = new TextField.StyleSheet();  
compareStyle.load(“myCss.css”);  
name\_txt.styleSheet = compareStyle;  
comment\_txt.styleSheet = compareStyle;  
//load xml  
function loadXML(success) {  
if (success) {  
//load sub menu  
vehicle = this.firstChild.childNodes;  
for (var i=0; i\<vehicle.length; i++) {  
item = attachMovie(“itemClip”, “itemClip” + i, i);  
item.\_x = 23;  
item.\_y = 255+i+i+i+i+i+i+i+i+i+i+i+i+i+i+i+i+i+i+i+i+i;  
//the following turns off the hand cursor on button rollover  
item.useHandCursor = true;  
//Since the dynamic txt field was placed in it’s own MC holder  
//with the instance name dyntext, I had to alter the path here  
item.dyntext.itemLabel.text = vehicle\*.attributes.name;  
item.myUrl = vehicle\*.attributes.url;  
//this starts the button fade in on rollover  
item.onRollOver = function() {  
this.gotoAndPlay(“fadeIn”);  
}  
//this starts the fade back to original position  
item.onRollOut = function() {  
this.gotoAndPlay(“fadeOut”);  
}  
item.onRelease = function() {  
[color=red]//Problem is here–HOW DO I LOAD THE NEXT SECTION?[/color]  
comment\_txt.htmlText = (this.\_root.comments);  
empty\_MC.loadMovie(this.\_root.image);  
}  
}  
//end load sub menu  
//  
\_root.comments = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;  
\_root.image = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;  
comment\_txt.htmlText = \_root.comments;  
empty\_MC.loadMovie(\_root.image);  
} else {  
trace(“file not loaded!”);  
}  
}  
xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“car1.xml”);

[http://www.fivepixelmedia.com/Clients/new.zip](http://www.fivepixelmedia.com/Clients/new.zip)
