CCMenu and CCMenuItem

Hi,

i am probably using CCMenu and CCMenuItem in the wrong way, since i cannot get it to work.
In practice, i have a layer where i want to add a CCMenu object. The CCMenu object is
created with 2 items: a background item (I1) and a button item (I2) that visually must appear above the background item:

---------
      I1 |
         |
 ___     |
|I2 | ___|
|___|

I want both item to be touchable.

I create the CCMenu object with an array containing the items (I1,I2).
If i use the order (I1,I2), the item I2, the button, is drawn above the item I1, the background,
but touching it will not trigger its menu selector handler but will trigger that of I1 (the menu selector
handler of I2 will be triggered only if i touch the part of it that does not overlaps with I1).
This is due to the fact that I1 is added as a child before I2 (but the rendering will be correct, because
I1 will have a z-order lower than I2).
If i use the order (I2,I1) the rendering is wrong (I1 above I2), but touching I2 will always trigger
its selection menu handler, as well as touching I1 where there is no overlap with I2 will always
trigger its menu selector handler.

I think i am using in the wrong way this classes (the scenario is really trivial), but i don’t know what am i doing wrong.
Any idea?

Thanks.

In my game I created a CCMenuItem subclass (in my case I called it ButtonItem). My button item has 3 CCSprites (used for the button’s back, normal, pressed and disabled) and one label (a subclass of CCLabel with added an shadow). The only problem I can see with your case would be that the target area is set by setContentSize and that’s a rectangle. You could (maybe?) have a ButtonItem with two sub CCMenuItems? Then the sub items could have the same selector.