1 Reply Latest reply on Oct 21, 2008 10:33 AM by Handycam

    Drag-able sprites?

    Handycam Level 1
      I have image objects I am adding to my project as children of a canvas object, and populating their source at runtime.

      I need to make these images drag-able, NOT drag and drop, just able to be dragged around by the user wherever they want within this canvas.

      I can't seem to find anything about making something drag-able this way. Everything I've found so far relates to making an object drag-able and looking for a target for a drop -- but I really just want my images to be user-positionable.
        • 1. Re: Drag-able sprites?
          Handycam Level 1
          OK, I wound up using the Flash.events.mousevent

          foo.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
          foo.addEventListener(MouseEvent.MOUSE_UP, stopDragging);

          and
          private function startDragging(event:MouseEvent):void
          {
          foo.startDrag();
          }

          private function stopDragging(event:MouseEvent):void
          {
          foo.stopDrag();
          }