Hey All,
So I’m trying to have a bunch of buttons generated in a for loop, and I want the onRelease function defined so that each button has a unique e-mail address attached to it.
As it stands now, all the buttons are being assigned the last e-mail address in the XML file. I’ve got more code in my actual file that creates text fields on top of the buttons, and they’re displaying the correct info, so it’s only the onRelease function that isn’t working…
Here’s the abridged code:
var xmlPeopleList:XML = new XML();
xmlPeopleList.ignoreWhite = true;
xmlPeopleList.onLoad = function(bSuccess:Boolean) {
if (bSuccess) {
var xnRoot:XMLNode = this.firstChild;
var xnPeople:XMLNode;
for (var i:Number = 0; i < xnRoot.childNodes.length; i++) {
xnPeople = xnRoot.childNodes*;
_level0.attachMovie(“hitArea”,“p”+i+"_mc",_level0.getNextHighestDepth());
eval(“p”+i+"_mc")._width = eval(“p”+i+"_txt")._width;
eval(“p”+i+"_mc")._height = eval(“p”+i+"_txt")._height;
eval(“p”+i+"_mc")._x = eval(“p”+i+"_txt")._x;
eval(“p”+i+"_mc")._y = eval(“p”+i+"_txt")._y;
eval(“p”+i+"_mc")._alpha=20;
// ----- Here’s the problem area ----- //
eval("p"+i+"_mc").onRelease = function():Void {
getURL("mailto:"+xnPeople.attributes.email);
}
}
}
};
xmlPeopleList.load(“xml/people.xml”);
Any help would be appreciated.
Thanks!
Steve