sensor problem...

Hi All, im using the alchemy port and getting this weird error when i try to create new sensor:

TypeError: Error #1006: value is not a function.
at cmodule.Box2D::FSM__Z20b2Body_CreateFixturePvP8_AS3_Val/work()
at Function/<anonymous>()
at Function/<anonymous>()
at Box2DAS.Dynamics::b2Fixture()[/Users/plug-inmedia/Documents/PIM_Work/bbc_driving_academy (trunk)/Production/Workspace/libs/box2d_alchemy/Box2DAS/Dynamics/b2Fixture.as:25]
at Box2DAS.Dynamics::b2Body/CreateFixture()[/Users/plug-inmedia/Documents/PIM_Work/bbc_driving_academy (trunk)/Production/Workspace/libs/box2d_alchemy/Box2DAS/Dynamics/b2Body.as:102]

heres my code ( this error is being thrown on the last line ( CreateFixture ) ):

var sBody : b2Body ;
b2Def.circle.m_radius = rad / PIXELS_TO_METERS ;
b2Def.fixture.shape = b2Def.circle ;
b2Def.body.position.v2 = new V2( px * _mapScale, py * _mapScale ) ;
var my_fixture:b2FixtureDef = new b2FixtureDef();
my_fixture.isSensor=true;
sBody = _world.CreateBody( b2Def.body ) ;
sBody.CreateFixture( my_fixture ) ;

Any help would be greatly appreciated! Cheers!
You're working with 2 different fixture objects, the one you create and the b2Def one. Try this:

Code:
var sBody : b2Body ;
b2Def.circle.m_radius = rad / PIXELS_TO_METERS ;
b2Def.fixture.shape = b2Def.circle ;
b2Def.body.position.v2 = new V2( px * _mapScale, py * _mapScale ) ;
// NO: var my_fixture:b2FixtureDef = new b2FixtureDef();
// NO: my_fixture.isSensor=true;
b2Def.fixture.isSensor = true; // YES
sBody = _world.CreateBody( b2Def.body ) ;
// NO: sBody.CreateFixture( my_fixture ) ;
sBody.CreateFixture( b2Def.fixture ) ; // YES
Hi! Thanks for your reply, I understand now that I was working with the wrong fixture. I implemented your suggested fix, and that had the effect of turning all the other b2Def objects in my game to sensors ( at least I think thats what happened as I lost all my collidables ) So I refactored my initiation code and came up with the following, but am still getting the same error! Am I doing sumfink stoopid?

var sBodyDef : b2BodyDef = new b2BodyDef() ;
sBodyDef.position.v2 = new V2( px * _mapScale, py * _mapScale ) ;

var circle : b2CircleShape = new b2CircleShape( rad / PIXELS_TO_METERS );
var fix : b2FixtureDef = new b2FixtureDef() ;
fix.shape = circle ;
fix.isSensor = true ;

var worldBody : b2Body = _world.CreateBody( sBodyDef ) ;
worldBody.CreateFixture( fix ) ;
I worked it out. I was passing the radius to the shape constructor instead of setting it correctly:

var circle : b2CircleShape = new b2CircleShape();
circle.m_radius = rad / PIXELS_TO_METERS ;

Now I just need to figure out how to get my contacts!

Thanks again!

Original thread: https://box2d.org/forum/viewtopic.php?t=7479