The DisplayObject has predefined events for interaction.

....

 

Register Event:

Button* button = new Button();
button->addEventListener(MouseEvent::MOUSEDOWN0, std::bind(&App::ONMOUSEDOWN0_button, this, std::placeholders::_1));
Catch Event:
void App::ONMOUSEDOWN0_button(const Event &event) {
     const MouseEvent& mouseEvent = *(MouseEvent*)(&event);
     Button* button= (Button*)event.data;

     //do something
}

Last edited Mar 27, 2013 at 11:15 PM by TypeOverride, version 5

Comments

No comments yet.