onPress question! (Flash 8 / AS2)

Hi,

I’m not sure this should’ve been posted in the actionscript forums, If its in the wrong place, I ask that one of you moderators move it to where it should be, thank you.

On to the actual question thats been bugging me for the past days. Let’s say you have a new flash project, you place one MovieClip on the stage, lets call it MC1 and add a onPress function for it, which traces “Hello!” when you press it, we all know this works as it should. Now, say I put a MovieClip inside of MC1, called MC2, and add a onPress function for this, which would trace “Hiya!” upon being pressed. This wouldn’t work for me, as the MC1 onPress function would get priority, is there any workaround for such behaviour?

Typical code for what I mean:


var tmp:MovieClip = _root.attachMovie("box", "MC1", 1); 
tmp.onPress = function(){
  trace("Hello!");
}
var tmp:MovieClip = _root.MC1.attachMovie("box", "MC2", 1);
tmp.onPress = function(){
  trace("Hiya!");
}

Thanks in advance.