I’ve been trying to get this to work for quite some time now, it’s a function to show a “map” of where you are on the page, based on a XML menu, it’s probably not the prettiest of codes as I’m not that experienced, but it works apart from one thing, it’s supposed to make movieclips named like this: “menumap”+i+"_mc" where *i *is an increasing number, and it does so correctly, but when it’s supposed to assign the onRollOver functions it only affects the last movieclip (menumap2_mc in my case), it finds the movieclips it lists, but they all seem to get the same name, so when I hover the first or second one, the last one get’s selected
and for some reason, when I click the last one, which should be number 2, it returns number 3 in “trace(menumap_item+" release");” and it’s not even supposed to go to 3
the values that gets sent to the showMap function are
where: the last subitem in the current dropdown menu, xml style(<SUBITEM title=“title” id=“7” />)
toplvl: the name of the menu from which the dropdown comes from
showMap = function (where, toplvl) {
var menumap_item;
var menumap_box = this.createEmptyMovieClip("menumap", 0);
if (where.parentNode.attributes.title != null) {
menumap_main.text = toplvl;
for (var i = 0; i<where.parentNode.childNodes.length; i++) {
menumap_item = menumap_box.attachMovie("menumap_sub", "menumap"+i+"_mc", (i+10));
menumap_item._x = 10;
menumap_item._y = 220+(menumap_item._height*i);
menumap_item.name.text = where.parentNode.childNodes*.attributes.title;
menumap_item.onRollOver = function() {
var col = new Color(menumap_item.background);
var textcol = new Color(menumap_item.name);
col.setTransform({ra:100, rb:-10, ga:100, gb:-10, ba:100, bb:-10});
textcol.setTransform({ra:100, rb:+100, ga:100, gb:+100, ba:100, bb:+100});
};
menumap_item.onRollOut = function() {
var col = new Color(menumap_item.background);
var textcol = new Color(menumap_item.name);
col.setTransform({ra:100, rb:0, ga:100, gb:0, ba:100, bb:0});
textcol.setTransform({ra:100, rb:0, ga:100, gb:0, ba:100, bb:0});
};
menumap_item.onRelease = function() {
trace(menumap_item+" release");
var col = new Color(menumap_item.background);
var textcol = new Color(menumap_item.name);
col.setTransform({ra:100, rb:0, ga:100, gb:0, ba:100, bb:0});
textcol.setTransform({ra:100, rb:0, ga:100, gb:0, ba:100, bb:0});
trace("clicked: "+i);
};
}
} else {
menumap_box.removeMovieClip();
menumap_main.text = toplvl;
}
};
please help, I can supply more code if needed, but everything else works like a charm