Confused about movieclip variables

Hello,

I’m not very good at this programming thing but I thought this might work:


_global.whichClicked;
b1.onMouseDown = function() {
    _global.whichClicked = 1;
};
b1.onMouseDown = function() {
    _global.whichClicked = 2;
};

This is in the first frame of my movie with but I only ever get the global variable set to 1 when I trace() it.

I would like each one of 18 movieclips to set a global variable to a certain number when pressed so another bit of code (in another movieclip) can read that number and decide what to do based on it.

Am I going about this all wrong?

Thanks in advance,

PhileasF.