How to do the bridge example in AS3

I am trying to make the bridge example run in AS3.

Using the example code I have found, these lines give Compiler Errors:

jd.anchorPoint.Set((100 + 44 * i) , 250 );

jd.anchorPoint.Set((100 + 44 * numPlanks) , 250 );

1119: Access of possibly undefined property anchorPoint through a reference with static type Box2D.Dynamics.Joints:b2DistanceJointDef.

I understand the Flash Box2d port is different from standard Box2d and the Box2d API Documentation.

The Flash version has anchorPoint1 and anchorPoint2 in the b2DistanceJointDef class instead of a single anchorPoint... Im not sure what to do...

Can anyone help me port the bridge to AS3?
Thanks
You must be using an older version. In 2.0.0, anchorPoints were renamed to localAnchor.

And as far as I know, distance joints never had just one anchor. b2RevoluteJoints and b2PrismaticJoints used to have just one anchor, so the definition objects for those had something called "anchorPoint", but b2DistanceJoint has always two of them. b2DistanceJoint's anchors are the points on the two bodies that you want to be a certain distance from each other. I think you had to specify them in world coordinates before 2.0.0, but the "localAnchors" in 2.0.0 are obviously in local coordinates.
shaktool wrote:
You must be using an older version. In 2.0.0, anchorPoints were renamed to localAnchor.

And as far as I know, distance joints never had just one anchor. b2RevoluteJoints and b2PrismaticJoints used to have just one anchor, so the definition objects for those had something called "anchorPoint", but b2DistanceJoint has always two of them. b2DistanceJoint's anchors are the points on the two bodies that you want to be a certain distance from each other. I think you had to specify them in world coordinates before 2.0.0, but the "localAnchors" in 2.0.0 are obviously in local coordinates.


So you are saying the example code for the bridge is written in an old version?
Is there a new version of the bridge code anywhere?
You can always grab the latest from the Subversion repository, which you can get to from http://sourceforge.net/projects/box2dflash, or hit the download page at http://sourceforge.net/project/showfile ... _id=210232

The bridge example should be using a revolute joint, not distance - maybe the earlier versions were written differently, but it's been revolute joints for a while, I think.

BTW, is the Flash testbed at http://box2dflash.sourceforge.net/ malfunctioning for anyone else, dropping all key-down events after the first one for each key? I can press left, right, and 'r' once apiece and then they stop responding... (just checked Safari, and it works right there - it's giving me trouble only in Firefox 3 on OS X - can anyone else confirm a problem, or is it just me? Other Flash games seem fine in the same browser, maybe the key handling is done differently for the testbed, exposing some browser bug?).
S'fine for me, FF3b5 Vista.
Works for me, both in Safari and in Firefox 2 on a Mac PowerPC.

Though I do know that:
-the way that various browsers on various operating systems report mouse and keyboard input to Flash is not 100% reliable, and
-the way that the Flash Box2D testbed records input is unusual, or at least not how I'm used to doing it.

Hmm.

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