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”);