From the Vault - Drag() a StartDrag/StopDrag replacement
DIGG IT!
1
Comments
Published
Wednesday, February 11, 2004
at
5:56 AM
.
I bought a 500GB Lacie Firewire hard drive and have been doing spring cleaning. I found this jewel from a long time ago and thought I would share. The example is a replacement for startDrag and stopDrag but allow many clips to be dragged at once across many different timelines.
The sample was intended to remove several limitations with startDrag/stopDrag. Even more useful is that with a feature equivalent replacement drag, startDrag/StopDrag can then be used for event based purposes in context with _droptarget. I believe the first version drag was created in the months following the release of Flash 5 as support for clipEvents was added combined with this new stuff called ActionScript.
Drag v1.0 Example
Source
The drag method used identical syntax to startDrag with the exception of passing a -1 to execute a stopDrag equivalent. Here is the code for the example:
mc_red.onPress = function(){this.drag(1,[150,150,450,450])}
mc_red.onReleaseOutside = mc_red.onRelease = function(){this.drag(-1)}
mc_blue.onPress = function(){this.drag(0,[50,50,550,550])}
mc_blue.onReleaseOutside = mc_blue.onRelease = function(){this.drag(-1)}
mc_green.onPress = function(){
this.drag();
mc_blue.drag(0,[150,150,450,450]);
mc_red.drag(0,[50,50,550,550]);
}
mc_green.onReleaseOutside = mc_green.onRelease = function(){
this.drag(-1);
mc_blue.drag(-1);
mc_red.drag(-1);
}
Simple and effective. In a later version I added logic to support onDrag and onDrop events and integrate this into the larger PowerSDK project.
Much more to come.
Enjoy,
Ted ;)

I used this AS to drag mc.
I found a question. If I want to load external image, mc couldn't drag. Could you tell me how to solve the question? Thanks a lot!!