# Embed Images into Flash via XML HELP!

**URL:** <https://forum.kirupa.com/t/embed-images-into-flash-via-xml-help/311930>\
**Category:** Uncategorized\
**Created:** [July 20, 2010, 4:41pm UTC](https://forum.kirupa.com/t/embed-images-into-flash-via-xml-help/311930 "2010-07-20T16:41:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fakierock](https://avatars.discourse-cdn.com/v4/letter/f/cab0a1/32.png) [@fakierock](https://forum.kirupa.com/u/fakierock)\
**Post date:** [July 20, 2010, 4:41pm UTC](https://forum.kirupa.com/t/embed-images-into-flash-via-xml-help/311930/1 "2010-07-20T16:41:14Z")

</div>

Hi, I’m hoping someone can help me with this!!

I’m working on a flash menu which has dropdowns. What I need to do is assign a different image to each dropdown so that when the user clicks on any of the menu titles a new image shows up below the menu.

I have an xml file for the dropdown menu, but isn’t there a way I can just add an image code within these or do I have to change the flash file aswell?

Here’s the code I have in the xml file:

\<?xml version=“1.0” encoding=“UTF-8”?\>  
\<content\>  
\<menu Name=“Why Ace”\>  
\<item Name=“About Ace?” Action =“getURL” Target=“about.html”\>\</item\>  
\<item Name=“Why Ace?” Action =“getURL” Target=“why.html”\>\</item\>  
\<item Name=“July Offer” Action =“getURL” Target=“offer.html”\>\</item\>  
\<item Name=“Upcoming Events” Action =“getURL” Target=“events.html”\>\</item\>  
\</menu\>  
\</content\>

Here’s the code in the flash file:

menuSpace = 0;  
bttnSpace = 0;  
tween = 5;  
tweenAlpha = 3;  
maxHeight = 10;  
fullscreen\_mcY = fullscreen\_mc.\_y;  
\_global.itemPress = function(obj) {  
if (obj.Action == “getURL”) {  
getURL(obj.Target, “”);  
} else if (obj.Action == “movieClip”) {  
\_root.content\_mc.gotoAndPlay(obj.Target);  
}  
};  
buildGallery = function () {  
total = xmlNode.childNodes.length;  
for (i=0; i\<total; i++) {  
categoryName\* = xmlNode.childNodes\*.attributes.Name;  
subNum\* = xmlNode.childNodes\*.childNodes.length;  
menu\_all.menu\_mc.duplicateMovieClip(“menu\_mc”+i, i);  
menu\_all[“menu\_mc”+i].\_x = (menu\_all.menu\_mc.\_width+menuSpace)_i;  
menu\_all[“menu\_mc”+i].categoryName.text = categoryName_;  
menu\_all[“menu\_mc”+i].ID = i;  
menu\_all[“menu\_mc”+i].num.text = subNum\*;  
for (j=0; j\<subNum\*; ++j) {  
menu\_all[“menu\_mc”+i].item\_mc.bttn\_mc.duplicateMovieClip(“bttn\_mc”+j, j);  
menu\_all[“menu\_mc”+i].item\_mc.\_alpha = 0;  
menu\_all[“menu\_mc”+i].item\_mc[“bttn\_mc”+j].ID = j;  
menu\_all[“menu\_mc”+i].item\_mc[“bttn\_mc”+j].\_y = (menu\_all[“menu\_mc”+i].item\_mc.bttn\_mc.\_height+bttnSpace)_j;  
menu\_all[“menu\_mc”+i].item\_mc[“bttn\_mc”+j].item\_name\_mc.item\_name.text = xmlNode.childNodes_.childNodes[j].attributes.Name;  
menu\_all[“menu\_mc”+i].item\_mc[“bttn\_mc”+j].Action = xmlNode.childNodes\*.childNodes[j].attributes.Action;  
menu\_all[“menu\_mc”+i].item\_mc[“bttn\_mc”+j].Target = xmlNode.childNodes\*.childNodes[j].attributes.Target;  
}  
}  
menu\_all.\_x = -(Stage.width-stageW)/2+(Stage.width-menu\_all.\_width)/2;  
menu\_all.divider\_mc.\_visible = true;  
loadID();  
};  
loadXML = function (loaded) {  
if (loaded) {  
toLoad = “holder”;  
xmlNode = this.firstChild;  
categoryName = [];  
subNum = [];  
buildGallery();  
} else {  
trace(“Error loading XML”);  
}  
};  
xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“content.xml”);  
stop();

Any help would be appreciated. I just need to add an image which will be displayed below each dropdown menu.

Thanks!
