Dragging bodies - will PAY for help!

Hi,

Moving on from my 'PLEASE HELP - skinning a body' post where people were very helpful, I have finally found a way by adapting the HelloWorld.fla and have created a circle on a string there, and have succesfully managed to skin it using the code to skin in helloworld.as

But in the hello world.as there is no functions for dragging the items.mousejoints.

I have tried using the code from the test.as in the phystest.fla collection, but to no luck

Code:
package{
   
   import flash.display.Sprite;
   import flash.events.Event;
   // Classes used in this example
   import Box2D.Dynamics.*;
   import Box2D.Collision.*;
   import Box2D.Collision.Shapes.*;
   import Box2D.Common.Math.*;
   
   
   
   
   
   import Box2D.Dynamics.Joints.*
   import Box2D.Dynamics.Contacts.*
   import flash.events.Event;
   import flash.display.*;
   import flash.text.*;
   import General.*
   
   public class HelloWorld extends Sprite{
      
      public function HelloWorld(){
         
         
         
         // Add event for main loop
         addEventListener(Event.ENTER_FRAME, Update, false, 0, true);
         
         
         
         // Creat world AABB
         var worldAABB:b2AABB = new b2AABB();
         worldAABB.lowerBound.Set(-100.0, -100.0);
         worldAABB.upperBound.Set(100.0, 100.0);
         
         // Define the gravity vector
         var gravity:b2Vec2 = new b2Vec2(0.0, 25.0);
         
         // Allow bodies to sleep
         var doSleep:Boolean = true;
         
         // Construct a world object
         m_world = new b2World(worldAABB, gravity, doSleep);
         
         /*// set debug draw
         var dbgDraw:b2DebugDraw = new b2DebugDraw();
         var dbgSprite:Sprite = new Sprite();
         addChild(dbgSprite);
         dbgDraw.m_sprite = dbgSprite;
         dbgDraw.m_drawScale = 30.0;
         dbgDraw.m_fillAlpha = 0.0;
         dbgDraw.m_lineThickness = 1.0;
         dbgDraw.m_drawFlags = 0xFFFFFFFF;
         m_world.SetDebugDraw(dbgDraw);*/
         
         
         
         // Vars used to create bodies
         var body:b2Body;
         var bodyDef:b2BodyDef;
         var boxDef:b2PolygonDef;
         var circleDef:b2CircleDef;
         
         
         
         // Add ground body
         bodyDef = new b2BodyDef();
         //bodyDef.position.Set(15, 19);
         bodyDef.position.Set(10, 21);
         //bodyDef.angle = 0.1;
         boxDef = new b2PolygonDef();
         boxDef.SetAsBox(30, 3);
         boxDef.friction = 0.3;
         boxDef.density = 0; // static bodies require zero density
         /*circleDef = new b2CircleDef();
         circleDef.radius = 10;
         circleDef.restitution = 0.2*/
         // Add sprite to body userData
         bodyDef.userData = new PhysGround();
         //bodyDef.userData = new PhysCircle();
         bodyDef.userData.width = 30 * 2 * 30;
         bodyDef.userData.height = 30 * 2 * 3;
         addChild(bodyDef.userData);
         body = m_world.CreateBody(bodyDef);
         body.CreateShape(boxDef);
         //body.CreateShape(circleDef);
         body.SetMassFromShapes();
         
         /// joint def ????
         var jd:b2RevoluteJointDef = new b2RevoluteJointDef();
            jd.lowerAngle = -15 / (180/Math.PI);
            jd.upperAngle = 15 / (180/Math.PI);
            jd.enableLimit = true;
            
         var ground:b2Body = m_world.GetGroundBody();
         var prevBody:b2Body = ground;
         var anchor:b2Vec2 = new b2Vec2();
         
         // Add some objects
         for (var i:int = 1; i < 20; i++){
            bodyDef = new b2BodyDef();
            bodyDef.position.x = 10;//Math.random() * 15 + 5;
            bodyDef.position.y = (i * 0.06 * 9);
            var rX:Number = Math.random() + 0.5;
            var rY:Number = Math.random() + 0.5;
            // Box
            if (i<=18){//Math.random() < 0.5
               boxDef = new b2PolygonDef();
               boxDef.SetAsBox(0.06, .3);
               boxDef.density = 40.0;
               boxDef.friction = 0.5;
               boxDef.restitution = 1;
               bodyDef.userData = new PhysBox();
               bodyDef.userData.width = 0.06 * 2 * 30;
               bodyDef.userData.height = .3 * 2 * 30;
               body = m_world.CreateBody(bodyDef);
               body.CreateShape(boxDef);
               
            // add joint???
               anchor.Set(10, (i * 0.06 * 9));
               jd.Initialize(prevBody, body, anchor);
               m_world.CreateJoint(jd);
               prevBody = body;
            } else {
               bodyDef.position.y = bodyDef.position.y + 1.1 ;
               circleDef = new b2CircleDef();
               circleDef.radius = 1.5;
               circleDef.density = 1.0;
               circleDef.friction = 0.5;
               circleDef.restitution = 0.2
               bodyDef.userData = new PhysCircle();
               bodyDef.userData.width = 1.5 * 2 * 30;
               bodyDef.userData.height = 1.5 * 2 * 30;
               body = m_world.CreateBody(bodyDef);
               body.CreateShape(circleDef);
               
               // add joint???
               anchor.Set(10, (i * 0.065 * 9) + 1.1);
               jd.Initialize(prevBody, body, anchor);
               m_world.CreateJoint(jd);
               prevBody = body;
            }
            body.SetMassFromShapes();
            addChild(bodyDef.userData);
         }
         
      }
      
   

      
      public function Update(e:Event):void{
         
         m_world.Step(m_timeStep, m_iterations);
         
         
         
         // Go through body list and update sprite positions/rotations
         for (var bb:b2Body = m_world.m_bodyList; bb; bb = bb.m_next){
            if (bb.m_userData is Sprite){
               bb.m_userData.x = bb.GetPosition().x * 30;
               bb.m_userData.y = bb.GetPosition().y * 30;
               bb.m_userData.rotation = bb.GetAngle() * (180/Math.PI);
               
         // Update mouse joint
         UpdateMouseWorld();
         //MouseDestroy();
         MouseDrag();
               
               
               
            }
         }
         
      }
      
      public var m_world:b2World;
      public var m_iterations:int = 10;
      public var m_timeStep:Number = 1.0/30.0;
      
      //======================
      // Member Data
      //======================
      //public var m_world:b2World;
      public var m_bomb:b2Body;
      public var m_mouseJoint:b2MouseJoint;
      //public var m_iterations:int = 10;
      //public var m_timeStep:Number = 1/30;
      public var m_physScale:Number = 30;
      // world mouse position
      static public  var mouseXWorldPhys:Number;
      static public  var mouseYWorldPhys:Number;
      static public  var mouseXWorld:Number;
      static public  var mouseYWorld:Number;
      // Sprite to draw in to
      //public var m_sprite:Sprite;
      
      //======================
      // Update mouseWorld
      //======================
      public function UpdateMouseWorld():void {
         mouseXWorldPhys = (Input.mouseX)/m_physScale;
         mouseYWorldPhys = (Input.mouseY)/m_physScale;

         mouseXWorld = (Input.mouseX);
         mouseYWorld = (Input.mouseY);
      }
      //======================
      // Mouse Drag
      //======================
      public function MouseDrag():void {
         // mouse press
         if (Input.mouseDown && !m_mouseJoint) {

            var body:b2Body = GetBodyAtMouse();
            trace("mouse press");
            if (body) {
               var md:b2MouseJointDef = new b2MouseJointDef();
               md.body1 = m_world.GetGroundBody();
               md.body2 = body;
               md.target.Set(mouseXWorldPhys, mouseYWorldPhys);
               md.maxForce = 300.0 * body.GetMass();
               md.timeStep = m_timeStep;
               m_mouseJoint = m_world.CreateJoint(md) as b2MouseJoint;
               body.WakeUp();
            }
         }
         // mouse release
         if (!Input.mouseDown) {
            if (m_mouseJoint) {
               m_world.DestroyJoint(m_mouseJoint);
               m_mouseJoint = null;
            }
         }
         // mouse move
         if (m_mouseJoint) {
            var p2:b2Vec2 = new b2Vec2(mouseXWorldPhys, mouseYWorldPhys);
            m_mouseJoint.SetTarget(p2);
         }
      }
      //======================
      // Mouse Destroy
      //======================
      /*public function MouseDestroy():void {
         // mouse press
         if (!Input.mouseDown && Input.isKeyPressed(68)) {

            var body:b2Body = GetBodyAtMouse(true);

            if (body) {
               m_world.DestroyBody(body);
               return;
            }
         }
      }*/
      //======================
      // GetBodyAtMouse
      //======================
      private var mousePVec:b2Vec2 = new b2Vec2();
      public function GetBodyAtMouse(includeStatic:Boolean=false):b2Body {
         // Make a small box.
         mousePVec.Set(mouseXWorldPhys, mouseYWorldPhys);
         var aabb:b2AABB = new b2AABB();
         aabb.lowerBound.Set(mouseXWorldPhys - 0.001, mouseYWorldPhys - 0.001);
         aabb.upperBound.Set(mouseXWorldPhys + 0.001, mouseYWorldPhys + 0.001);

         // Query the world for overlapping shapes.
         var k_maxCount:int = 10;
         var shapes:Array = new Array();
         var count:int = m_world.Query(aabb, shapes, k_maxCount);
         var body:b2Body = null;
         for (var i:int = 0; i < count; ++i) {
            if (shapes[i].GetBody().IsStatic() == false || includeStatic) {
               var tShape:b2Shape = shapes[i] as b2Shape;
               var inside:Boolean = tShape.TestPoint(tShape.GetBody().GetXForm(), mousePVec);
               if (inside) {
                  body = tShape.GetBody();
                  break;
               }
            }
         }
         return body;
      }
      
   }

}



this is my code and you can see the mouse functions I added at the end. The mousekill I had to quote (nor need it ) as it was causing and error in my new flash CS4 (yay!).

Can anyone see what I'm doing wrong. I just want o be able to drag the hanging circle thing around!

Thanks in advance!

Joe
Anyone got any ideas?

I am happy to PAY anyone to look at the .fla and .as to help me, may have other things I need help on.

Thanks
Your problem is that you're not initializing or updating the Input utility class, which causes MouseDestroy to fail, and causes the mouse input not to function.

Add this to the constructor.
Code:
m_input = new Input(this);

This somewhere where your member declarations are.
Code:
public var m_input:Input;

Then this at the END of your update function.
Code:
m_input.Update();

And uncomment your MouseDestroy function and the call to it in Update.
Also make sure you have the General folder with Input.as in it.

Hope that helps,

-Matt
Thanks Skatehead, think I am getting there but still not working.

am getting this now:
1061: Call to a possibly undefined method Update through a reference with static type General:Input.

Hmmmmm, am happy to donate to the cause if someone can fix it....

New code is.. (is this right? I have marked the new items you suggested with //***************** after them to help find them)
Code:
package{
   
   import flash.display.Sprite;
   import flash.events.Event;
   // Classes used in this example
   import Box2D.Dynamics.*;
   import Box2D.Collision.*;
   import Box2D.Collision.Shapes.*;
   import Box2D.Common.Math.*;
 
   
   
   
   
   import Box2D.Dynamics.Joints.*
   import Box2D.Dynamics.Contacts.*
   import flash.events.Event;
   import flash.display.*;
   import flash.text.*;
   import General.*
   
   public class HelloWorld extends Sprite{
     
      public function HelloWorld(){
         
         
         
         // Add event for main loop
         addEventListener(Event.ENTER_FRAME, Update, false, 0, true);
         
         
         
         // Create world AABB
         var worldAABB:b2AABB = new b2AABB();
         worldAABB.lowerBound.Set(-100.0, -100.0);
         worldAABB.upperBound.Set(100.0, 100.0);
         
         // Define the gravity vector
         var gravity:b2Vec2 = new b2Vec2(0.0, 25.0);
         
         // Allow bodies to sleep
         var doSleep:Boolean = true;
         
         // Construct a world object
         m_world = new b2World(worldAABB, gravity, doSleep);
      
       m_input = new Input(this); //*********************
         
         /*// set debug draw
         var dbgDraw:b2DebugDraw = new b2DebugDraw();
         var dbgSprite:Sprite = new Sprite();
         addChild(dbgSprite);
         dbgDraw.m_sprite = dbgSprite;
         dbgDraw.m_drawScale = 30.0;
         dbgDraw.m_fillAlpha = 0.0;
         dbgDraw.m_lineThickness = 1.0;
         dbgDraw.m_drawFlags = 0xFFFFFFFF;
         m_world.SetDebugDraw(dbgDraw);*/
         
         
         
         // Vars used to create bodies
         var body:b2Body;
         var bodyDef:b2BodyDef;
         var boxDef:b2PolygonDef;
         var circleDef:b2CircleDef;
         
         
         
         // Add ground body
         bodyDef = new b2BodyDef();
         //bodyDef.position.Set(15, 19);
         bodyDef.position.Set(10, 21);
         //bodyDef.angle = 0.1;
         boxDef = new b2PolygonDef();
         boxDef.SetAsBox(30, 3);
         boxDef.friction = 0.3;
         boxDef.density = 0; // static bodies require zero density
         /*circleDef = new b2CircleDef();
         circleDef.radius = 10;
         circleDef.restitution = 0.2*/
         // Add sprite to body userData
         bodyDef.userData = new PhysGround();
         //bodyDef.userData = new PhysCircle();
         bodyDef.userData.width = 30 * 2 * 30;
         bodyDef.userData.height = 30 * 2 * 3;
         addChild(bodyDef.userData);
         body = m_world.CreateBody(bodyDef);
         body.CreateShape(boxDef);
         //body.CreateShape(circleDef);
         body.SetMassFromShapes();
         
         /// joint def ????
         var jd:b2RevoluteJointDef = new b2RevoluteJointDef();
            jd.lowerAngle = -15 / (180/Math.PI);
            jd.upperAngle = 15 / (180/Math.PI);
            jd.enableLimit = true;
           
         var ground:b2Body = m_world.GetGroundBody();
         var prevBody:b2Body = ground;
         var anchor:b2Vec2 = new b2Vec2();
         
         // Add some objects
         for (var i:int = 1; i < 20; i++){
            bodyDef = new b2BodyDef();
            bodyDef.position.x = 10;//Math.random() * 15 + 5;
            bodyDef.position.y = (i * 0.06 * 9);
            var rX:Number = Math.random() + 0.5;
            var rY:Number = Math.random() + 0.5;
            // Box
            if (i<=18){//Math.random() < 0.5
               boxDef = new b2PolygonDef();
               boxDef.SetAsBox(0.06, .3);
               boxDef.density = 40.0;
               boxDef.friction = 0.5;
               boxDef.restitution = 1;
               bodyDef.userData = new PhysBox();
               bodyDef.userData.width = 0.06 * 2 * 30;
               bodyDef.userData.height = .3 * 2 * 30;
               body = m_world.CreateBody(bodyDef);
               body.CreateShape(boxDef);
               
            // add joint???
               anchor.Set(10, (i * 0.06 * 9));
               jd.Initialize(prevBody, body, anchor);
               m_world.CreateJoint(jd);
               prevBody = body;
            } else {
               bodyDef.position.y = bodyDef.position.y + 1.1 ;
               circleDef = new b2CircleDef();
               circleDef.radius = 1.5;
               circleDef.density = 1.0;
               circleDef.friction = 0.5;
               circleDef.restitution = 0.2
               bodyDef.userData = new PhysCircle();
               bodyDef.userData.width = 1.5 * 2 * 30;
               bodyDef.userData.height = 1.5 * 2 * 30;
               body = m_world.CreateBody(bodyDef);
               body.CreateShape(circleDef);
               
               // add joint???
               anchor.Set(10, (i * 0.065 * 9) + 1.1);
               jd.Initialize(prevBody, body, anchor);
               m_world.CreateJoint(jd);
               prevBody = body;
            }
            body.SetMassFromShapes();
            addChild(bodyDef.userData);
         }
         
      }
     
   

     
      public function Update(e:Event):void{
         
         m_world.Step(m_timeStep, m_iterations);
         
         
         
         // Go through body list and update sprite positions/rotations
         for (var bb:b2Body = m_world.m_bodyList; bb; bb = bb.m_next){
            if (bb.m_userData is Sprite){
               bb.m_userData.x = bb.GetPosition().x * 30;
               bb.m_userData.y = bb.GetPosition().y * 30;
               bb.m_userData.rotation = bb.GetAngle() * (180/Math.PI);
               
         // Update mouse joint
         UpdateMouseWorld();
         MouseDestroy();
         MouseDrag();
               
               
               
            }
      
         }
         m_input.Update(); //*********************
      }
     
      public var m_world:b2World;
      public var m_iterations:int = 10;
      public var m_timeStep:Number = 1.0/30.0;
     
      //======================
      // Member Data
      //======================
      //public var m_world:b2World;
     public var m_input:Input; //**********************
      public var m_bomb:b2Body;
      public var m_mouseJoint:b2MouseJoint;
      //public var m_iterations:int = 10;
      //public var m_timeStep:Number = 1/30;
      public var m_physScale:Number = 30;
      // world mouse position
      static public  var mouseXWorldPhys:Number;
      static public  var mouseYWorldPhys:Number;
      static public  var mouseXWorld:Number;
      static public  var mouseYWorld:Number;
      // Sprite to draw in to
      //public var m_sprite:Sprite;
     
      //======================
      // Update mouseWorld
      //======================
      public function UpdateMouseWorld():void {
         mouseXWorldPhys = (Input.mouseX)/m_physScale;
         mouseYWorldPhys = (Input.mouseY)/m_physScale;

         mouseXWorld = (Input.mouseX);
         mouseYWorld = (Input.mouseY);
      }
      //======================
      // Mouse Drag
      //======================
      public function MouseDrag():void {
         // mouse press
         if (Input.mouseDown && !m_mouseJoint) {

            var body:b2Body = GetBodyAtMouse();
            trace("mouse press");
            if (body) {
               var md:b2MouseJointDef = new b2MouseJointDef();
               md.body1 = m_world.GetGroundBody();
               md.body2 = body;
               md.target.Set(mouseXWorldPhys, mouseYWorldPhys);
               md.maxForce = 300.0 * body.GetMass();
               md.timeStep = m_timeStep;
               m_mouseJoint = m_world.CreateJoint(md) as b2MouseJoint;
               body.WakeUp();
            }
         }
         // mouse release
         if (!Input.mouseDown) {
            if (m_mouseJoint) {
               m_world.DestroyJoint(m_mouseJoint);
               m_mouseJoint = null;
            }
         }
         // mouse move
         if (m_mouseJoint) {
            var p2:b2Vec2 = new b2Vec2(mouseXWorldPhys, mouseYWorldPhys);
            m_mouseJoint.SetTarget(p2);
         }
      }
      //======================
      // Mouse Destroy
      //======================
      public function MouseDestroy():void {
         // mouse press
         if (!Input.mouseDown && Input.isKeyPressed(68)) {

            var body:b2Body = GetBodyAtMouse(true);

            if (body) {
               m_world.DestroyBody(body);
               return;
            }
         }
      }
      //======================
      // GetBodyAtMouse
      //======================
      private var mousePVec:b2Vec2 = new b2Vec2();
      public function GetBodyAtMouse(includeStatic:Boolean=false):b2Body {
         // Make a small box.
         mousePVec.Set(mouseXWorldPhys, mouseYWorldPhys);
         var aabb:b2AABB = new b2AABB();
         aabb.lowerBound.Set(mouseXWorldPhys - 0.001, mouseYWorldPhys - 0.001);
         aabb.upperBound.Set(mouseXWorldPhys + 0.001, mouseYWorldPhys + 0.001);

         // Query the world for overlapping shapes.
         var k_maxCount:int = 10;
         var shapes:Array = new Array();
         var count:int = m_world.Query(aabb, shapes, k_maxCount);
         var body:b2Body = null;
         for (var i:int = 0; i < count; ++i) {
            if (shapes[i].GetBody().IsStatic() == false || includeStatic) {
               var tShape:b2Shape = shapes[i] as b2Shape;
               var inside:Boolean = tShape.TestPoint(tShape.GetBody().GetXForm(), mousePVec);
               if (inside) {
                  body = tShape.GetBody();
                  break;
               }
            }
         }
         return body;
      }
     
   }

}
well, the error says that there is no method named Update in the input class. If you have a look in the class, theres a method named update, with a lowercase u, try using that one!
I'm really not sure what you mean. I am thick at box 2d!

Can you be more specific and spell it out? If the Update should be update, what do I change? Where do I change it? What do you mean by class (the HelloWorld class, the input class...)????

Please be patient, it is all to easy for you wizards to forget what it is like to be a layman.

OK, I have removed the line in 179 and it seems to work! Although a little slow. I tried changing the Update to update on 179 and got an error.

Can you please just show me what you mean? Could you take the code above, edit it and then post it again and then say exactly what you have done, where you have done it, and anything else in VERY simple terminology.

Thanks
OK, Thanks to everyone for their patience, it is uncalled for and above your duties!! But I can't take any more!

I'll be making a donation to the box2d cause but I am also offering this little project up for a quick PAID fix...

click here to see the thread - viewtopic.php?f=8&t=1709

Thanks
(double post)
i meant
Code:
m_input.Update();

should be
Code:
m_input.update();

thats what your error was stating

Quote:
Please be patient, it is all to easy for you wizards to forget what it is like to be a layman.

😀 😀 im a layman just like you but trying to use correct terminology in order to give a clear answer
ok new code: (have deleted some of the quoted stuff to tidy it up)
Code:
package{
   
   import flash.display.Sprite;
   import flash.events.Event;
   // Classes used in this example
   import Box2D.Dynamics.*;
   import Box2D.Collision.*;
   import Box2D.Collision.Shapes.*;
   import Box2D.Common.Math.*;
   import Box2D.Dynamics.Joints.*
   import Box2D.Dynamics.Contacts.*
   import flash.events.Event;
   import flash.display.*;
   import flash.text.*;
   import General.*
   
   
   public class HelloWorld extends Sprite{
     
      public function HelloWorld(){
          m_input = new Input(this); //*********************
         
         
         // Add event for main loop
         addEventListener(Event.ENTER_FRAME, Update, false, 0, true);
         
         
         
         // Create world AABB
         var worldAABB:b2AABB = new b2AABB();
         worldAABB.lowerBound.Set(-100.0, -100.0);
         worldAABB.upperBound.Set(100.0, 100.0);
         
         // Define the gravity vector
         var gravity:b2Vec2 = new b2Vec2(0.0, 25.0);
         
         // Allow bodies to sleep
         var doSleep:Boolean = true;
         
         // Construct a world object
         m_world = new b2World(worldAABB, gravity, doSleep);
      
      
         
         // set debug draw
         var dbgDraw:b2DebugDraw = new b2DebugDraw();
         var dbgSprite:Sprite = new Sprite();
         addChild(dbgSprite);
         dbgDraw.m_sprite = dbgSprite;
         dbgDraw.m_drawScale = 30.0;
         dbgDraw.m_fillAlpha = 0.0;
         dbgDraw.m_lineThickness = 1.0;
         dbgDraw.m_drawFlags = 0xFFFFFFFF;
       //m_world.SetDebugDraw(dbgDraw);
         
         
         
         // Vars used to create bodies
         var body:b2Body;
         var bodyDef:b2BodyDef;
         var boxDef:b2PolygonDef;
         var circleDef:b2CircleDef;
         
         /// joint def ????
         var jd:b2RevoluteJointDef = new b2RevoluteJointDef();
            jd.lowerAngle = -15 / (180/Math.PI);
            jd.upperAngle = 15 / (180/Math.PI);
            jd.enableLimit = true;
           
         var ground:b2Body = m_world.GetGroundBody();
         var prevBody:b2Body = ground;
         var anchor:b2Vec2 = new b2Vec2();
         var spacing = 0.06;
         // Add some objects
         for (var i:int = 1; i < 20; i++){
            bodyDef = new b2BodyDef();
            bodyDef.position.x = 10;//Math.random() * 15 + 5;
            bodyDef.position.y = (i * 0.06 * 9);
            var rX:Number = Math.random() + 0.5;
            var rY:Number = Math.random() + 0.5;
            // Box
            if (i<=18){//Math.random() < 0.5
               boxDef = new b2PolygonDef();
               boxDef.SetAsBox(0.06, .3);
               boxDef.density = 40.0;
               boxDef.friction = 0.5;
               boxDef.restitution = 1;
               bodyDef.userData = new PhysBox();
               bodyDef.userData.width = 0.06 * 2 * 30;
               bodyDef.userData.height = .3 * 2 * 30;
               body = m_world.CreateBody(bodyDef);
               body.CreateShape(boxDef);
               
            // add joint???
               anchor.Set(9.9, (i * 0.058 * 9));
               jd.Initialize(prevBody, body, anchor);
               m_world.CreateJoint(jd);
               prevBody = body;
            } else {
               bodyDef.position.y = bodyDef.position.y + 1.1 ;
               circleDef = new b2CircleDef();
               circleDef.radius = 1.5;
               circleDef.density = 1.0;
               circleDef.friction = 0.5;
               circleDef.restitution = 0.2
               bodyDef.userData = new PhysCircle();
               bodyDef.userData.width = 1.5 * 2 * 30;
               bodyDef.userData.height = 1.5 * 2 * 30;
               body = m_world.CreateBody(bodyDef);
               body.CreateShape(circleDef);
               
               // add joint???
               anchor.Set(10, (i * 0.058 * 9) + 1.1);
               jd.Initialize(prevBody, body, anchor);
               m_world.CreateJoint(jd);
               prevBody = body;
            }
            body.SetMassFromShapes();
            addChild(bodyDef.userData);
         }
         
      }
     
   

     
      public function Update(e:Event):void{
         
         m_world.Step(m_timeStep, m_iterations);
         m_input = new Input(this); //*********************
      
         
         
         // Go through body list and update sprite positions/rotations
         for (var bb:b2Body = m_world.m_bodyList; bb; bb = bb.m_next){
            if (bb.m_userData is Sprite){
               bb.m_userData.x = bb.GetPosition().x * 30;
               bb.m_userData.y = bb.GetPosition().y * 30;
               bb.m_userData.rotation = bb.GetAngle() * (180/Math.PI);
               
         // Update mouse joint
         UpdateMouseWorld();
         MouseDestroy();
         MouseDrag();
                               
            }
      
         }
         m_input.update(); //*********************
      }
     
      public var m_world:b2World;
      public var m_iterations:int = 10;
      public var m_timeStep:Number = 1.0/30.0;
     
      //======================
      // Member Data
      //======================
      //public var m_world:b2World;
     public var m_input:Input; //**********************
      public var m_bomb:b2Body;
      public var m_mouseJoint:b2MouseJoint;
      //public var m_iterations:int = 10;
      //public var m_timeStep:Number = 1/30;
      public var m_physScale:Number = 30;
      // world mouse position
      static public  var mouseXWorldPhys:Number;
      static public  var mouseYWorldPhys:Number;
      static public  var mouseXWorld:Number;
      static public  var mouseYWorld:Number;
      // Sprite to draw in to
      //public var m_sprite:Sprite;
     
      //======================
      // Update mouseWorld
      //======================
      public function UpdateMouseWorld():void {
         mouseXWorldPhys = (Input.mouseX)/m_physScale;
         mouseYWorldPhys = (Input.mouseY)/m_physScale;

         mouseXWorld = (Input.mouseX);
         mouseYWorld = (Input.mouseY);
      }
      //======================
      // Mouse Drag
      //======================
      public function MouseDrag():void {
         // mouse press
         if (Input.mouseDown && !m_mouseJoint) {

            var body:b2Body = GetBodyAtMouse();
            trace("mouse press");
            if (body) {
               var md:b2MouseJointDef = new b2MouseJointDef();
               md.body1 = m_world.GetGroundBody();
               md.body2 = body;
               md.target.Set(mouseXWorldPhys, mouseYWorldPhys);
               md.maxForce = 300.0 * body.GetMass();
               md.timeStep = m_timeStep;
               m_mouseJoint = m_world.CreateJoint(md) as b2MouseJoint;
               body.WakeUp();
            }
         }
         // mouse release
         if (!Input.mouseDown) {
            if (m_mouseJoint) {
               m_world.DestroyJoint(m_mouseJoint);
               m_mouseJoint = null;
            }
         }
         // mouse move
         if (m_mouseJoint) {
            var p2:b2Vec2 = new b2Vec2(mouseXWorldPhys, mouseYWorldPhys);
            m_mouseJoint.SetTarget(p2);
         }
      }
      //======================
      // Mouse Destroy
      //======================
      public function MouseDestroy():void {
         // mouse press
         if (!Input.mouseDown && Input.isKeyPressed(68)) {

            var body:b2Body = GetBodyAtMouse(true);

            if (body) {
               m_world.DestroyBody(body);
               return;
            }
         }
      }
      //======================
      // GetBodyAtMouse
      //======================
      private var mousePVec:b2Vec2 = new b2Vec2();
      public function GetBodyAtMouse(includeStatic:Boolean=false):b2Body {
         // Make a small box.
         mousePVec.Set(mouseXWorldPhys, mouseYWorldPhys);
         var aabb:b2AABB = new b2AABB();
         aabb.lowerBound.Set(mouseXWorldPhys - 0.001, mouseYWorldPhys - 0.001);
         aabb.upperBound.Set(mouseXWorldPhys + 0.001, mouseYWorldPhys + 0.001);

         // Query the world for overlapping shapes.
         var k_maxCount:int = 10;
         var shapes:Array = new Array();
         var count:int = m_world.Query(aabb, shapes, k_maxCount);
         var body:b2Body = null;
         for (var i:int = 0; i < count; ++i) {
            if (shapes[i].GetBody().IsStatic() == false || includeStatic) {
               var tShape:b2Shape = shapes[i] as b2Shape;
               var inside:Boolean = tShape.TestPoint(tShape.GetBody().GetXForm(), mousePVec);
               if (inside) {
                  body = tShape.GetBody();
                  break;
               }
            }
         }
         return body;
      }
     
   }

}


so the Update is now update and still get the error:

1061: Call to a possibly undefined method update through a reference with static type General:Input.

The zip of ALL the files is at http://www.orangeonastring.com/orange.zip

Thanks in advance, I appreciate all you guys sticking with me on this one.

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