squirrelFinder + header

Hi,

I’m trying to modify the squirrelFinder, by adding a header. So I’ve added a new textbox with the instanceName: “header_txt” in the: “infobox_mc” movieClip. So now theres two textboxes in the: “infobox_mc” movieClip: “header_txt” and “content_txt”.

The problem is, that it loads the text in my: “content_txt” textbox, and not my: “header_txt” textbox.

Anybody got a solution to this?

My AS:
[AS]// DisplayInfo is used when an item is pressed
// it hides the menu_mc (and the buttons) and shows the
// infobox_mc, assigning the text of the selected button
// to the textbox within.
function DisplayInfo(){
menu_mc._visible = false;
infobox_mc._visible = true;
infobox_mc.content_txt.text = this.location_text;
infobox_mc.content_txt.text = this.header_text;
}
// close_btn is in infobox_mc ands restores
// the menu (clearing the info text and hiding itself as well)
infobox_mc.close_btn.onRelease = function(){
menu_mc._visible = true;
infobox_mc._visible = false;
infobox_mc.content_txt.text = “”;
infobox_mc.header_txt.text = “”;
}
infobox_mc._visible = false; // start the info box hidden

// define basic variables for setting up the menu
var item_spacing = 28; // how far menu items are spaced veritcally
var item_count = 0; // counts menu items as they are added from the XML
// CreateMenu creates a menu based on the XML object passed.
// It loops through all the items with a for loop adding clips to the menu_mc
// movieclip on the timeline, defining the appropriate text where needed
function CreateMenu(menu_xml){
// start with the first item in the XML
var items = menu_xml.firstChild.firstChild.childNodes; // menu -> menuitems -> child nodes array
for (var i=0; i<items.length; i++) {
// only continue if the type of this item is a squirrel
if (items*.attributes.type == “squirrel”) {
// create variables for our elements
var species = items*.firstChild; // same as items*.childNodes[0]
var location = items*.childNodes[1]; // second child node
var header = items*.childNodes[2];

// Create a menu item movie clip in the menu_mc instance on the main timeline
// for each item element offsetting each additional further down the screen
var item_mc = menu_mc.attachMovie(“menu_item”,“item”+item_count, item_count);
item_mc._y = item_count * item_spacing;
item_count++;

// assign text using nodeValue to get the text
// from the text nodes and CDATA sections
item_mc.species_txt.text = species.firstChild.nodeValue;
item_mc.main_btn.location_text = location.firstChild.nodeValue;
item_mc.main_btn.header_text = header.firstChild.nodeValue;
// set the onRelease of the item button to the DisplayInfo function
item_mc.main_btn.onRelease = DisplayInfo;
}
}
}
// CreateMenu2 uses nextSibling and a do-while loop to
// access all the items in the XML. It functions exactly the
// same as CreateMenu, just with a different technique (NOT USED)
function CreateMenu2(menu_xml){
// start with the first item in the XML
var currItem = menu_xml.firstChild.firstChild.firstChild; // menu -> menuitems -> first item
do {
// only continue if the type of this item is a squirrel
if (items*.attributes.type == “squirrel”) {
// create variables for our elements
var species = currItem.firstChild;
var location = species.nextSibling;
var header = species.nextSibling;

// Create a menu item movie clip in the menu_mc instance on the main timeline
// for each item element offsetting each additional further down the screen
var item_mc = menu_mc.attachMovie(“menu_item”,“item”+item_count, item_count);
item_mc._y = item_count * item_spacing;
item_count++;

// assign text using nodeValue to get the text
// from the text nodes and CDATA sections
item_mc.species_txt.text = species.firstChild.nodeValue;
item_mc.main_btn.location_text = location.firstChild.nodeValue;
item_mc.main_btn.header_text = header.firstChild.nodeValue;
// set the onRelease of the item button to the DisplayInfo function
item_mc.main_btn.onRelease = DisplayInfo;
}

} while (currItem = currItem.nextSibling); // continue loop if more items exist after current
}

// manage XML
// create new XML object instance, remembering to ignore white space
var squirrel_xml = new XML();
squirrel_xml.ignoreWhite = true;
// define an onLoad to create our location menu when the XML has successfully loaded.
squirrel_xml.onLoad = function(success){
if (success) CreateMenu(this);
else trace(“Error loading XML file”); // no success? trace error (wont be seen on web)
}
// load the xml file!
squirrel_xml.load(“squirrel_finder.xml”);[/AS]my XML file:

<?xml version="1.0" ?>
<menu>
<menuitems sourceurl="[http://spot.colorado.edu/~halloran/sqrl.html](http://spot.colorado.edu/~halloran/sqrl.html)">
<item type="squirrel">
<species>Cybercitys investors sell out</species>
<location>
	<![CDATA[The newspaper Borsen, wrote last day, that Cybercitys investors was planning to sell out, big shares of their stocks in Cybercity]]>
</location>
<tester>This is my header text</tester>
</item type="squirrel">........

Just some stupid, and NON real news