How to create multiple versions of an image?

I have an icon on the stage, that when the user drag’s I want them to drag a copy, be able to release it, and go and get another one, whilst leaving the orginal in it’s place. I’ve tried the code below, but it only let’s me make one copy.

Any clues?

on (press) {
startDrag(this, true);
duplicateMovieClip(this,“mc”+i,i);
}

on (release)(
stopDrag();
}

Imcrement the value of i each time:

on (press) {
startDrag(this, true);
i++;
duplicateMovieClip(this,"mc"+i,i);
}
on (release)(
stopDrag();
}

Hmm looking better at what you’re trying to do, you’d better use something like this:

on (press) {
	i++;
	mc = this.duplicateMovieClip("mc"+i, i);
	mc.startDrag(true);
	mc.onMouseUp = function() {
		this.stopDrag();
	};
}

Great, this let’s me make multiple duplicates, but not of the original icon. I can duplicate each duplicate fine.

Hmmmmmm

It’s working fine here …

My post must have crossed with your second peice of code. Yeah that works great! So what was I doing wrong?

Ok, to complicate matters more…once the clip has been duplicated I wanted the user to be able to drag it over a ‘dropzone’ much like a trashcan, if they didn’t want it on the scene anymore. Now a second clip still duplicates the first.

I had some code like this in before.

onClipEvent (mouseUp) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
this.stopDrag();

if (_root.dropzone.hitTest(this._x,this._y,true)) {
	unloadMovie(this);

any idea how I integrate that with the new code!?

here’s a link to the .fla, it should give you an idea of what I’m trying to produce.

Your help as ever, greatly appreciated.

http://www.jumpto.co.uk/kirupa/test.fla

Something like this?

And your initial code wont work because you were setting the startDrag and stopDrag methods to the original movieclip, not the duplicates.

Excellent! Thanks so much. Now, so I learn something here, so when you press the icon, the on

(press) {
_parent.dragBox();
}

calls an instance of the dragbox onto the main stage right?
where the function

function dragBox() {
i++;
mc = icon.duplicateMovieClip(“mc”+i, i);
mc.startDrag(true);
mc.onPress = function() {
this.startDrag(true);
};
mc.onMouseUp = function() {
if (this.hitTest(dropzone)) {
this.removeMovieClip();
} else {
this.stopDrag();
}
};
}

On frame 1 applies to the dragbox? leaving the original alone. I’ve never used the function command before.

Anyway’s thanks again for all your help, saved me from a real headache.

When you press the original clip you call the function dragBox, and the function takes care of duplicating and assigning the events to them.

Thanks again

welcome :slight_smile: