Hi everybody,
I have a custom object with some boxes inside, and I want the whole object to detect BEGIN_CONTACT events.
The code looks like:
Quote:
public class MyObject extends BodyShape {
public override function create():void {
reportBeginContact = true;
addEventListener(ContactEvent.BEGIN_CONTACT, beginContactHandler);
super.create();
}
private function beginContactHandler(e:ContactEvent):void {
trace("CONTACT DETECTED!");
}
}
With it I don't get the begin contact events, but if I extend my class from shapes.Box, it does. Is this correct? I find strange to subclass my shape from a box, since I have some other shapes (actually shapes.Box) inside. How could I get the contact events when extending direct from BodyShape?
Thanks for your help!