Thanks but no, I was careful to define that callback and the error happens the line before when I define the first callback.
Here's my whole code:
Code:
package view.characters
{
import shapes.*;
import Box2DAS.*;
import Box2DAS.Collision.*;
import Box2DAS.Collision.Shapes.*;
import Box2DAS.Common.*;
import Box2DAS.Dynamics.*;
import Box2DAS.Dynamics.Contacts.*;
import Box2DAS.Dynamics.Joints.*;
import cmodule.Box2D.*;
import wck.*;
import misc.*;
import flash.utils.*;
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.geom.*;
import flash.ui.*;
public class HeroCharacter extends Box
{
private var contacts:ContactList;
public override function create():void {
reportBeginContact = true;
reportEndContact = true;
contacts = new ContactList();
contacts.listenTo(this);
fixedRotation = true;
listenWhileVisible(world, StepEvent.STEP, world_stepEventHandler, false, 0, true);
listenWhileVisible(this, ContactEvent.BEGIN_CONTACT, this_beginContactHandler, false, 0, true);
super.create();
}
private function world_stepEventHandler(e:StepEvent):void
{
var left:Boolean = Input.kd('LEFT', 'A');
var right:Boolean = Input.kd('RIGHT', 'D');
var jump:Boolean = Input.kp('UP', ' ', 'W');
if (jump) {
b2body.ApplyImpulse(new V2(0, -2), b2body.GetWorldCenter());
}
else if(left) {
b2body.ApplyImpulse(new V2(-2, 0), b2body.GetWorldCenter());
}
else if(right) {
b2body.ApplyImpulse(new V2(2, 0), b2body.GetWorldCenter());
}
}
private function this_beginContactHandler(e:ContactEvent):void
{
}
}
}
Notice the tutorial didn't say anything about the import directives, I copied them from World.as
Also I find it strange that the simulation doesn't stop ? The dummy box falls to the ground but I can't move the HeroCharacter box (because I suppose it's not initialized properly)
Any other ideas ?
Thanks!