# Var problems :/

**URL:** <https://forum.kirupa.com/t/var-problems/238853>\
**Category:** Uncategorized\
**Created:** [September 16, 2007, 7:02am UTC](https://forum.kirupa.com/t/var-problems/238853 "2007-09-16T07:02:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Takashy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/takashy/32/1985_2.png) [@Takashy](https://forum.kirupa.com/u/Takashy)\
**Post date:** [September 16, 2007, 7:02am UTC](https://forum.kirupa.com/t/var-problems/238853/1 "2007-09-16T07:02:04Z")

</div>

I got a little problem in flash and I kinda run out of ideas…

my flash is pretty simple, with a hit test. I got 3 objects (only now,I will need probably more)

One is controlled by me and the other 2 are just standing still.

Basically its like that. If the MC controlled by me touches one of the other 2 MC’s it sets a var (lets say X) to something. like x=1; and if my MC does not touch that other MC x should be 0 but I kinda can’t figure out how to do that.

I made some little code and putted it on the 2 other MC’s:

onClipEvent (enterFrame) {  
if (this.hitTest(\_root.My\_MC)) {  
\_root.X = 1;  
} else {  
\_root.X = 0;  
}  
}

or something like that, the problem is that it works only on one of the 2 MC’s, on the other it does not work, it simply does not set X = 1 again ☹

so Im goesing that the first one is setting x all the time to 0 but I need it to set it to 0 only once, so I was wondering if someone could help me with that. Or maybe there is a different code I could use to get it to work… 😕
