using some help from another forum, I've made a step closer to what i was looking for, but I'm still not quite there..
Currently with the code below, instead of displaying the image, I get the name of the image displaying in the OUTPUT window of Flash (and not image in my image holder)
(the code creates an XML driven menu - The menu itself works fine, but what I want it to do is is when a menu item is clicked, it should place an image into an MC image holder.
I have created an MC on the stage with the instance name imageHolder)
Hoping somebody could take a look and let me know where I have gone wrong..
thanks in advance..
Here is my XML
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<menu>
<menu buttonName = "item 1" imgName="1.jpg"/>
<menu buttonName = "item 2" imgName="2.jpg"/>
<menu buttonName = "item 3" imgName="3.jpg"/>
</menu>
here is my AS2:
Code:
pages.stop();
ready = false;
speed = 5;
xStart = 5;
yStart = 48;
bWidth = 82;
bHeight = 18;
var menuXml = new XML();
//loadXml("../assets/xml-menu/menu.xml");
loadXml("test.xml");
function loadXml(file:String) {
menuXml.ignoreWhite = true;
menuXml.onLoad = loadMapData;
menuXml.load(file);
function loadMapData() {
for (var i = 0; i<this.firstChild.childNodes.length; i++) {
var bn = this.firstChild.childNodes[i].attributes.buttonName;
var b = _root.attachMovie("button", bn, i);
var img = this.firstChild.childNodes[i].attributes.imgName;
b.link = img;
b._x = xStart;
b._y = yStart+(bHeight*i);
b.txt = bn;
b.onPress = function() {
trace(this.link);
// imageHolder.loadMovie(this.link); // load to empty movieclip
pages.gotoAndStop(this.txt);
pages.heading = this.txt;
target = this._y;
};
/*b.onRollOver = function() {
this.gotoAndStop(2);
};
b.onRollOut = function() {
this.gotoAndStop(1);
};*/
}
}
}
var c = this.attachMovie("current", "current", 100);
var d = this.attachMovie("draw", "draw", 101);
d._x = 5;
d._y = 160;
c._x = xStart+bWidth;
c._y = 200;
target = yStart;
this.onEnterFrame = function() {
if (ready) {
current._y += (target-current._y)/speed;
}
};