# ActionScript 2.0's Fundamental Nature

**URL:** <https://forum.kirupa.com/t/actionscript-2-0s-fundamental-nature/321560>\
**Category:** Uncategorized\
**Created:** [April 23, 2011, 1:04pm UTC](https://forum.kirupa.com/t/actionscript-2-0s-fundamental-nature/321560 "2011-04-23T13:04:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![protonxp](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/protonxp/32/3110_2.png) [@protonxp](https://forum.kirupa.com/u/protonxp)\
**Post date:** [April 23, 2011, 1:04pm UTC](https://forum.kirupa.com/t/actionscript-2-0s-fundamental-nature/321560/1 "2011-04-23T13:04:07Z")

</div>

Hello there,

I’ve been working on a project that requires a decent amount of variables and hitTesting.

As I’ve come to realize by trial and error, (or at least what I deduced), Flash can’t execute the same actions on different MovieClips if the variables they’re changing are the same.

Example:

> MovieClip 1

```auto
onClipEvent(enterFrame){
if(MC1_mc.hitTest(_root.a_mc)){
_root.myVar = true;
}
}

```

MovieClip 2

```auto
onClipEvent(enterFrame){
if(MC2_mc.hitTest(_root.a_mc)){
_root.myVar = true;
}
}

```

This would be a drastically stripped down version of what I have on my two MovieClips.

What I am wondering is, if I am correct. Because what I have running is a trigger for “a\_mc” to be moved to a specific x and y coordinate when something touches the first MC, but when something touches MC2\_mc, a\_mc moves to a different location.

What happen when I ran the movie was that the first MovieClip moved a\_mc, but not the second. Even though the code was exactly the same, with just the instance names changed. I guessed that Flash just completely failed to run the second script.

I did find a solution by creating and If/Else Statement on the actually MovieClip to be moved, but I was wondering …

–

Another problem …

I was also using the keyboard, for inputting movement on a character. What I need is the certain keypresses to be treated like flash buttons. With releases. Is the only way to do this by creating a Boolean variable that toggles between on and off?

-Proto
