I'm having some problems making a real-time strategy game. So far I've made a map and placed the player's units on it.
But now I need to select the units. I've tried a couple of things to get a variable (_root.selected) to hold the instance name instead of the source MC name.
I've failed each time. I know for a fact that the instances exist, but for some reason the code in them isn't working.
Is it even possible to have duplicated MCs interact with eachother, or on their own? I've used them in games before but that was also with just 1 MC for the user, and duplicated ones as enemies.
In this case the duplicated MCs will be for both the user and the computer... Is it possible for them to interact or am I aiming way above flash's capabilities?
it works when you click on the source movieclip "carrier", but when you click on "car1" or "car2" (the duplicated MCs of "Carrier") _root.selected becomes null.
Change the code Tonypa gave you to "onClipEvent(mouseUp)", and you can also get rid of your "onClipEvent (load)" code also. I was having the same problem as you until I changed that.. seems to be giving the correct names now.