# Intermediate XML/image integration and pathing

**URL:** https://forum.kirupa.com/t/intermediate-xml-image-integration-and-pathing/216628
**Category:** Uncategorized
**Created:** [February 19, 2007, 5:34am UTC](https://forum.kirupa.com/t/intermediate-xml-image-integration-and-pathing/216628 "2007-02-19T05:34:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![aletheus](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@aletheus](https://forum.kirupa.com/u/aletheus)
#### Post date: [February 19, 2007, 5:34am UTC](https://forum.kirupa.com/t/intermediate-xml-image-integration-and-pathing/216628/1 "2007-02-19T05:34:26Z")

</div>

I have some general questions about how this stuff works: I have included the actionscript below, and I have posted it here before. I have added a couple of lines trying to get item\_mc (a dynamically duplicated movieclip connected to links.xml) I want to be able to add a rollover function that would change a central image (image\_mc perhaps?) by loading image URLS referenced in links.xml, along with each address and link text which are included within the same link node (see underneath actionscript). I’ve gotten the URL function to work thanks so someone on here before. what I seem to be doing wrong is in the pathing of the file. I have an empty movie clip (menu\_mc which generates the xml link menu as item\_mc) and I want to attach functionality to another empty movie clip on the stage called image\_mc. I can’t tell where I’m at in relating the different movie clip paths within the actionscript panel. the site currently has this functionality, but using javascript. I’m replacing the current jpgs with pngs, and I want flash to manage the entire site instead of javascript for two reasons. one, I don’t know much about javascript, and two I want the site owner to be able to simply manipulate xml nodes and replace image and txt files so they have control over the site. any ideas? [water.unt.edu/](http://www.water.unt.edu/)

var item\_spacing = 25;  
var item\_count = 0;  
function menuGenerator(links) {  
[COLOR=“Red”]// start with the first item in the XML[/COLOR]  
var items:Array = links.firstChild.firstChild.childNodes;  
[COLOR=“Red”]//items should equal this.menu.links.link[/COLOR]  
for (var i:Number = 0; i\<items.length; i++) {  
var linkTxt:Array = items\*.childNodes[0];  
[COLOR=“Red”]//linkTxt should equal this.menu.links.link.name[/COLOR]  
var linkAddress:String = items\*.childNodes[0].attributes.href;  
[COLOR=“Red”]//linkAddress should equal this.menu.links.link.name.attributes.href[/COLOR]  
var imageAddress:MovieClip=items\*.childNodes[0].attributes.image;  
[COLOR=“Red”]//imageAddress should equal this.menu.links.link.name.attributes.image  
//should imageAddress be a string instead?[/COLOR]  
var item\_mc:MovieClip = menu\_mc.attachMovie(“button1\_mc”, “button”+item\_count, item\_count_2);  
item\_mc.\_y = item\_count_item\_spacing;  
item\_count++;  
item\_mc.linkTxt\_mc.linkTxt\_txt.text = linkTxt.childNodes[0].nodeValue;  
item\_mc.blendMode = “normal”;  
item\_mc.onRelease= function(){  
this.getURL(linkAddress);  
}  
item\_mc.onRollOver=function(){  
this.image\_mc.loadMovie(imageAddress);  
[COLOR=“Red”]//should this line have \_parent or \_root instead of this?[/COLOR]  
}  
}  
}  
var links:XML = new XML();  
links.ignoreWhite = true;  
links.onLoad = function(success) {  
if (success) {  
menuGenerator(this);  
} else {  
trace(“Error loading XML file”);  
}  
};  
links.load(“links.xml”);

stop();

\<menu\>  
\<links\>  
\<link\>  
\<name href="" image=“images/about.png”\>about\</name\>  
\</link\>  
\<link\>  
\<name href="" image=“images/courses.png”\>courses\</name\>  
\</link\>  
\<link\>  
\<name href="" image=“images/research.png”\>research\</name\>  
\</link\>  
\<link\>  
\<name href="" image=“images/public.png”\>publication & presentation\</name\>  
\</link\>  
\<link\>  
\<name href="" image=“images/waterways.png”\>waterways\</name\>  
\</link\>  
\<link\>  
\<name href="" image=“images/film.png”\>film projects\</name\>  
\</link\>  
\<link\>  
\<name href="" image=“images/art.png”\>art projects\</name\>  
\</link\>  
\<link\>  
\<name href="" image=“images/reservoir.png”\>reservoir\</name\>  
\</link\>  
\<link\>  
\<name href="" image=“images/org.png”\>organizations & events\</name\>  
\</link\>  
\</links\>  
\</menu\>
