PDA

View Full Version : duplicatemovieclip issue


milhowsse
05-10-2005, 01:29 PM
im trying to set up a simple drag and drop so that when the original mc is clicked, it duplicates the the mc and begins to drag the duplicate. the issue im having is determining the instance name for the stopDrag.
//------------------------------
i = 0;
mcPaper.onPress = function() {
mcPaper.duplicateMovieClip("mcPaper"+i);
startDrag(["mcPaper"+i]);
i += 1;
};
what goes here?.onRelease = function() {
stopDrag();
var trashed:Boolean = mcTrashcan.hitTest(this);
if (trashed) {
this.gotoAndPlay("go");
mcTrashcan.gotoAndStop("full");
}
};
//------------------------------

any help would be appreciated
:confused:

milhowsse
05-11-2005, 01:01 AM
ttt. anyone?

oka_
05-11-2005, 01:22 AM
Hey, try doing something like this:

i = 0;
mcPaper.onPress = function() {
newClip = mcPaper.duplicateMovieClip("mcPaper"+i);

newClip.onRelease = function() {
stopDrag();
var trashed:Boolean = mcTrashcan.hitTest(this);
if (trashed) {
this.gotoAndPlay("go");
mcTrashcan.gotoAndStop("full");
}

startDrag(newClip);
i += 1;
};


hope that helps
-oka

milhowsse
05-11-2005, 06:52 PM
it is recognizing the new variable "newClip" as the duplicated movie but it doesnt recognize the onRelease for some reason. i have to click the dragged object a second time to initiate the stopdrag.

any ideas?

milhowsse
05-11-2005, 07:14 PM
figured it out. here is the code that worked:

i = 0;
mcPaper.onPress = function() {
dup = mcPaper.duplicateMovieClip("mcPaper"+i);
num = dup;
startDrag(dup);
mcPaper.onReleaseOutside = function() {
trace("released");
stopDrag();
var trashed:Boolean = mcTrashcan.hitTest(dup);
if (trashed) {
i++;
removeMovieClip(dup);
} else {
removeMovieClip(dup);
}
};
};


for the onRelease function, i changed it from dup.onRelease (dup is the var referencing the duped MC) to the original mc (mcPaper) and changed onRelease to onReleaseOutside. that did the trick