Generally speaking, I believe that the DragManager is intended
for open drag and drop operations where an item might have a target to be
dropped into (such as dragging a file into a folder). The startDrag and
stopDrag methods are equally as important, but are better suited for
constrained or custom drag operations where the drag must be within a container
or follow a set path (such as dragging a playhead across the track of an mp3 or
video player). Custom dragging is great for creating unique user interfaces and
custom components.
Ben Stucki
---------------------------------
We're Hiring! Seeking a passionate developer to join our team building Flex
based products. Position is in the Washington D.C.
metro area. If interested contact [EMAIL PROTECTED]
----------------------------------------
From: "Daniel Freiman" <[EMAIL PROTECTED]>
Sent: Friday, February 09, 2007 7:59 AM
To: [email protected]
Subject: Re: [flexcoders] Re: StartDrag() versus DragManager.doDrag()
I can't speak to Adobe's intent, but I regularly avoid startDrag because I need
more fine control over the drag. For example if you want to program a drag that
implements "snap to" functionality, you're going to want to have direct control
over the placement of the object, instead of letting the player handle it. As
I said, I don't know why Adobe did it in this case, but here's an example of
why someone might want to do it somewhere.
- Dan
On 2/9/07, Derrick Grigg <[EMAIL PROTECTED]> wrote:
> I can't find anywhere that we use startDrag()in the framework,
> including in the DragManager.
My bad, you know what they say about 'assuming'.
Just did some more digging, in the DragProxy class and was very
surprised to see that it actually uses a mouse move event listener and
then repositions the drag proxy based on the the x/y of the mouse.
var pt:Point = new Point();
var point:Point = new Point(event.localX, event.localY);
point = DisplayObject(event.target).localToGlobal(point);
point =
DisplayObject(dragInitiator.systemManager.topLevelSystemManager).globalToLocal(point);
var mouseX:Number = point.x;
var mouseY:Number = point.y;
x = mouseX - xOffset;
y = mouseY - yOffset;
This just begs the question, why??? Why go through all that instead of
just using the startDrag that is a core method of the Sprite class?
Just to offset the DragProxy slightly from the mouse pointer? I don't
get it, why bloat (in my opinion) the code. From my understanding
classes and methods that are actually compiled into the flash plugin
(ie the flash.* package) run faster than those that are not (ie. the
mx.* package). I don't understand why all the extra code is required
to accomplish something the plugin already has the ability to do.