Rev joints

EDIT: Problem Solved, see solution at bottom


I recently started learning Box2d for flash, so this would probably be classed as a newbie question. However I'm getting a error that I don't know how to solve.
my code for creating a joint is this:

Code:
var jointDef:b2RevoluteJointDef = new b2RevoluteJointDef ()   
         
jointDef.Initialize (circle,mainBody, circle.GetPosition())

var joint:b2RevoluteJoint = _world.CreateJoint (jointDef)


and my error is
Code:
Implicit coercion of a value with static type Box2D.Dynamics.Joints:b2Joint to a possibly unrelated type


I'm sure that my error is because the CreateJoint method requires a jointDef, not a RevolueJointDef, but I don't know how to work around it.

Thanks for the help

EDIT:

My hunch on the error reason was wrong, its because my final joint should have been a b2Joint, not a b2RevoluteJoint. Code:
Code:
   var jointDef:b2RevoluteJointDef = new b2RevoluteJointDef ()   
         
   jointDef.Initialize (circle, mainBody, circle.GetPosition())

   var joint:b2Joint = _world.CreateJoint (jointDef)

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