ActionScript 2.0's Fundamental Nature

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

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

MovieClip 2

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