Activate on 'click'?

Trying to create objects that do not begin to fall until the user interacts with them.

I can make objects that fall, I can make them not fall via SetActive(false). What i cant figure out how to do is detect a inactive object via click/release and set it to active.

Any guidance is greatly appreciated.
Here's a function I'm using to find bodies at the mouse's position when clicked:

Code:
private function FindBodyAtMouse(e:MouseEvent):void
      {
         mouseBody = null;         
         mVec.Set(mouseX / RATIO, mouseY / RATIO);
         
         if (!GameBase.mPaused)
         {         
            //Check to see if there's a body under the mouse cursor.
            var node:b2Body = _world.GetBodyList();   
            var done:Boolean = false;
            
            if (node)
            {
               while (node && !done)
               {
                  if (node.GetFixtureList())
                  {
                     if (node.GetFixtureList().TestPoint(mVec))
                     {
                        mouseBody = node;
                        //Set your body to active here:               
                        done = true;
                     }
                  }
                  
                  node = node.GetNext();
               }
            }
         }
      }


Once you find your body under the mouse, you can set its active flag to true.

Note: You might have to change some of the conditionals to work within your engine but I hope you get the gist of it. Let me know if you have questions.
For large worlds, you'll want do check for objects under the mouse a little more efficiently:

Code:
      public function pressedLeft(e:MouseEvent):void {
         updateFromMouseEvent(e);
         
         // if we missed a mouse up event, finish it here
         if(isDragging) clicks++;
         
         isDragging = true;
         
         // if any objects are clicked on that are draggable,
         // add mouse joint and drag them!
         
         // find all unique bodies affected by the click
         var bodies:Dictionary = new Dictionary();
         function clickedOn(fixture:b2Fixture):Boolean {
            var b:b2Body = fixture.GetBody();
            bodies[b] = b;
            return true;
         }
         
         Main.world.QueryPoint(clickedOn, posWorld);
         
         for(var body in bodies) {
            var draggable:TSDraggable = body.GetUserData() as TSDraggable;
            
            if(draggable != null) {
               // after the initial click, its up to the
               // draggable object to poll to see
               // if isDragging = false
               draggable.startDrag(this);
            }
         }
      }


I use a dictionary instead of an array, so that I can convert from fixtures to unique bodies. If I click in a way where I hit two fixtures of the same body, I still only clicked that body once.
^^^Interesting! Thanks!

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