Firs of all, you should be listening for mousedown or mouseup event:
b[i].addEventListener('mousedown', function() {
///
});
Second, where does the m variable come from in your handleMouseDown(m, b) function?
Third, you make bText a global variable, witch is a bad thing,
etc ... , please clean up your snippet by removing non-trivial things for the functionality you are asking to help, and keep only relevant code.
For better response, please write a basic code you need help on, so we can test it. Right now no one can run your code, therefore cannot test without investing time to figure out what's going on. Help us help you by not copy/pasting excerption from your code.
Here's a small example how to handle mousedown event on a Group object
var win = new Window("palette", "script");
var group = win.add('group');
group.preferredSize = [100, 30];
group.graphics.backgroundColor = group.graphics.newBrush(group.graphics.BrushType.SOLID_COLOR, [0.123, 0.456, 0.789]);
group.addEventListener('mousedown', function() {
alert('you clicked on group');
});
win.center();
win.show();
... View more