# How to create multiple versions of an image?

**URL:** <https://forum.kirupa.com/t/how-to-create-multiple-versions-of-an-image/42580>\
**Category:** flash\
**Created:** [February 10, 2004, 5:33pm UTC](https://forum.kirupa.com/t/how-to-create-multiple-versions-of-an-image/42580 "2004-02-10T17:33:59Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhunki](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@mhunki](https://forum.kirupa.com/u/mhunki)\
**Post date:** [February 10, 2004, 5:33pm UTC](https://forum.kirupa.com/t/how-to-create-multiple-versions-of-an-image/42580/1 "2004-02-10T17:33:59Z")

</div>

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();  
}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 10, 2004, 5:36pm UTC](https://forum.kirupa.com/t/how-to-create-multiple-versions-of-an-image/42580/2 "2004-02-10T17:36:11Z")

</div>

Imcrement the value of i each time:

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

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 10, 2004, 5:46pm UTC](https://forum.kirupa.com/t/how-to-create-multiple-versions-of-an-image/42580/3 "2004-02-10T17:46:21Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 10, 2004, 5:50pm UTC](https://forum.kirupa.com/t/how-to-create-multiple-versions-of-an-image/42580/4 "2004-02-10T17:50:29Z")

</div>

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

Hmmmmmm

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 10, 2004, 6:57pm UTC](https://forum.kirupa.com/t/how-to-create-multiple-versions-of-an-image/42580/5 "2004-02-10T18:57:00Z")

</div>

It’s working fine here …

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 11, 2004, 9:20am UTC](https://forum.kirupa.com/t/how-to-create-multiple-versions-of-an-image/42580/6 "2004-02-11T09:20:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 11, 2004, 9:24am UTC](https://forum.kirupa.com/t/how-to-create-multiple-versions-of-an-image/42580/7 "2004-02-11T09:24:57Z")

</div>

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!?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 11, 2004, 9:29am UTC](https://forum.kirupa.com/t/how-to-create-multiple-versions-of-an-image/42580/8 "2004-02-11T09:29:59Z")

</div>

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](http://www.jumpto.co.uk/kirupa/test.fla)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 11, 2004, 4:49pm UTC](https://forum.kirupa.com/t/how-to-create-multiple-versions-of-an-image/42580/9 "2004-02-11T16:49:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 12, 2004, 9:11am UTC](https://forum.kirupa.com/t/how-to-create-multiple-versions-of-an-image/42580/10 "2004-02-12T09:11:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 12, 2004, 12:01pm UTC](https://forum.kirupa.com/t/how-to-create-multiple-versions-of-an-image/42580/11 "2004-02-12T12:01:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 12, 2004, 12:06pm UTC](https://forum.kirupa.com/t/how-to-create-multiple-versions-of-an-image/42580/12 "2004-02-12T12:06:43Z")

</div>

Thanks again

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 12, 2004, 12:19pm UTC](https://forum.kirupa.com/t/how-to-create-multiple-versions-of-an-image/42580/13 "2004-02-12T12:19:32Z")

</div>

welcome 🙂
