how can i do event code like flash's addeventlistener,removeeventlistener.

I am now migrating a flash game to cocos2d.In flash as3,event code is add and remove like this:
mc.addEventListener(Event.Click,this.onclick);
mc.removeEventListener(Event.Click,this.onclick);
I want to realize this method on top of cocos2d’s event dispatch code,Is it posible?
if it is posible, migrating code will be very easy.

Yes, you can write own subclass of CCNode or CCLayer that supports such API. Some hints:
# Override cleanup() method in your subclass and unregister all registered handlers on cleanup. Otherwise you node will be never deleted, because cocos2dx adds strong reference to object when you register it as touch handler.
# You should check if touch intersects with node before call Event.Click event listener: convert touch to point in node space (CCNode has method for that), create rect CCRect(0, 0, node.getContentSize().width, node.getContentSize().height) and check if point is inside rect (CCRect has method for that).
# You also should check how exactly mouse and keyboard events dispatched in flash, and emulate this behavior. For example, it’s possible that keyboard event dispatched recursively first for parent node, than for it’s children.