Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 02-17-2010, 03:40 PM   #1
Registered User
Join Date: Feb 2010
Posts: 1
Default Drag and Drop Child Movieclip

Just trying to muddle through as3.

I am trying to implement a drag and drop feature that allows the user to the drag and drop multiple copies of the same movieclip leaving the orignial behind in the same position on the stage.

I have the code to create the drag and drop - how do I now do it so that it is the duplicate that is dragged in AS3

Code below:
// Drag & Drop
signRetirement.addEventListener(MouseEvent.MOUSE_D OWN, grabMe);
signRetirement.buttonMode = true;

var me:Object;
function grabMe(e:MouseEvent):void{
me = e.currentTarget;
me.removeEventListener(MouseEvent.MOUSE_DOWN, grabMe);
stage.addEventListener(MouseEvent.MOUSE_MOVE, dragMe);
stage.addEventListener(MouseEvent.MOUSE_UP, dropMe);
function dropMe(e:MouseEvent):void {
stage.removeEventListener(MouseEvent.MOUSE_UP, dropMe);
stage.removeEventListener(MouseEvent.MOUSE_MOVE, dragMe);
me.addEventListener(MouseEvent.MOUSE_DOWN, grabMe);
function dragMe(e:MouseEvent):void {
bella28 is offline   Reply With Quote
Old 02-17-2010, 04:34 PM   #2
Interactive Des/Dev
Join Date: Jan 2010
Location: Philadelphia, PA
Posts: 232

My initial thought is that you'd need to write a clone function for your sprite. So when it's dropped, you can call me.clone();

clone() would look something like:

public function clone():Sprite
return new ClassName();
jooniya is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 05:42 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.