One of the easiest way to pass through this problem is hitTest API & a logic. Just write a function which test that which button the user hits via mouse and return its value to onRelease function .Write something like this:
Code:
// chk bt returns the index of item which is pressed
function chk_bt() {
for (var i:Number =0; i< nIcons ; i++) {
// u can replace the nIcon variable with the one having the number of total dynamic buttons created
var name:String = Items[i].Name;
var mc:String = name + "_mc";
temp = eval(mc); // or _root[mc] if they are in root or this[mc]
if (temp.hitTest(_xmouse, _ymouse)) {
break;
}
}
return i;
}
Now , write onRelease function like this :
Code:
this[mc].onRelease = function()
{
trace(" click " + chk_bt());
}
Wish u luck ..
Best Regards,
SajiSoft