# Confused about movieclip variables

**URL:** https://forum.kirupa.com/t/confused-about-movieclip-variables/244868
**Category:** flash
**Created:** [November 22, 2007, 8:28pm UTC](https://forum.kirupa.com/t/confused-about-movieclip-variables/244868 "2007-11-22T20:28:33Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![phileasFoggy](https://avatars.discourse-cdn.com/v4/letter/p/b38774/32.png) [@phileasFoggy](https://forum.kirupa.com/u/phileasFoggy)
#### Post date: [November 22, 2007, 8:28pm UTC](https://forum.kirupa.com/t/confused-about-movieclip-variables/244868/1 "2007-11-22T20:28:33Z")

</div>

Hello,

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

```auto

_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.
