PDA

View Full Version : Dragging a duplicated movie clip?



nauds
July 31st, 2003, 04:43 PM
I created a button that duplicates a movie clip, I want the user to be able to drag the duplicated movie clip.

Right now, it duplicates the movie clip but when I try to drag it, it moves the first movie clip (the one being duplicated) instead of the one which was duplicated.

Any ideas?

rolando.lopez
July 31st, 2003, 04:54 PM
set up a small movie clip (like a small dot). attach the small clip to the first movie clip. On the new small clip enter this._visible = false so noone can see it.
Next, on frame 1 of the small clip enter
_parent.onPress = function() {
_parent.startDrag(false, 5,25,200,250);
};
with whatever constraints you might want. I am assuming you'll have a similar onPress function on the original movie clip, just copy it over to the small clip and add _parent before it.

Hope it helps!

thoriphes
July 31st, 2003, 04:54 PM
If the dragging code is in the movieclip that's being duplicated, then the code will also be in the duplicates, meaning you should be able to drag all your duplicates.

could you spare us an FLA?

nauds
July 31st, 2003, 05:11 PM
this is the current FLA

thoriphes
July 31st, 2003, 05:19 PM
here's your FLA fixed, free of charge.

nauds
July 31st, 2003, 06:41 PM
wow, thank you =)

rolando.lopez
August 1st, 2003, 10:14 AM
nauds,
Thoriphes solution is great. The mistake in your FLA is that when you started the drag you had it linked to _root.circle. The only movie clip with that name is the original circle. Which is why only the original circle would move. Make sense? Thoriphes' fix works because "this" was used.