# Movieclip code help please

**URL:** https://forum.kirupa.com/t/movieclip-code-help-please/118036
**Category:** Uncategorized
**Created:** [August 2, 2004, 7:24am UTC](https://forum.kirupa.com/t/movieclip-code-help-please/118036 "2004-08-02T07:24:13Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![flufilms](https://avatars.discourse-cdn.com/v4/letter/f/e56c9b/32.png) [@flufilms](https://forum.kirupa.com/u/flufilms)
#### Post date: [August 2, 2004, 7:24am UTC](https://forum.kirupa.com/t/movieclip-code-help-please/118036/1 "2004-08-02T07:24:13Z")

</div>

[font=Arial]Hi all.

Have been helped out and given some code to do something beyond my knowledge as I’m still very much a novice, the code is great but doesn’t do exactly what I want…

I would like to use duplicatemovie (command) to make a copy of a moviesymbol when the viewer clicks on the symbol, - that’s easy, the complication is that I want the properties for the orignial and the clone to be different.  
ORIGINAL: Duplicate onto stage / Draggable if necessary

CLONE: Draggable / NOT duplicatable / Deletable when viewer clicks on symbol and hits DEL key.

I have been given (very kindly) the following code:

on (press) {  
\_global.i++;  
if(this.\_name.indexOf(“cir”)!=0){  
this.duplicateMovieClip(“cir”+\_global.i, \_global.i);  
}else{  
if(Key.isDown(Key.DELETE)){  
this.removeMovieClip();  
}  
}  
startDrag(this);  
}  
on (release, releaseOutside) {  
stopDrag();  
}

* * *

This seems to be on the right lines, except it is the original that loses the ability to duplicate instead of the clone (which still duplicates when clicked), + the DEL option does not appear to work

I have been entering the code onto the actual object and not the frame which I believe is correct, should certain symbol be Instance-Named anything in particular?

I really need to get this wrapped up and greatly appreciate all the help I’ve had so far from everybody, can any spot what would need changing in the code to achieve my goal?

Thanks so much, any help would be severely worshipped.

N[/font]

---

<div class="post-metadata">

### Author: ![pom](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@pom](https://forum.kirupa.com/u/pom)
#### Post date: [August 2, 2004, 1:45pm UTC](https://forum.kirupa.com/t/movieclip-code-help-please/118036/2 "2004-08-02T13:45:39Z")

</div>

Hi 🙂

If you don’t mind, I’m going to try to rewrite that code using dynamic event handlers, they’re much more practical as you’ll see:

```auto
clipCounter = 0 ;

// Function called when you press the original clip
function duplicateMe () {
clipCounter ++ ;
var dup = this.duplicateMovieClip ("c" + clipCounter, clipCounter) ;
dup.onPress = dragMe ;
dup.onRelease = dup.onReleaseOutside = stopDrag ;
} ;

// Function called when you press the clone
function dragMe () {
this.startDrag (true) ;
Key.addListener (this) ;
this.onKeyDown = function () {
if (Key.isDown (Key.DELETE) this.removeMovieClip () ;
} ;
} ;

Function called when you release the clone
function stopDrag () {
this.stopDrag () ;
delete this.onKeyDown ;
} ;

// You'll have to call the original: originalClip
originalClip.onPress = duplicateMe ;

```

This _should_ work a little bit better :mu:

---

<div class="post-metadata">

### Author: ![pom](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@pom](https://forum.kirupa.com/u/pom)
#### Post date: [August 2, 2004, 2:02pm UTC](https://forum.kirupa.com/t/movieclip-code-help-please/118036/3 "2004-08-02T14:02:22Z")

</div>

Stupid as tag still doesn’t work, sorry about that…

---

<div class="post-metadata">

### Author: ![pom](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@pom](https://forum.kirupa.com/u/pom)
#### Post date: [August 3, 2004, 8:44am UTC](https://forum.kirupa.com/t/movieclip-code-help-please/118036/4 "2004-08-03T08:44:01Z")

</div>

Please don’t crosspost, especially if you’re going to post twice in the same forum.

---

<div class="post-metadata">

### Author: ![sWo0p](https://avatars.discourse-cdn.com/v4/letter/s/f0a364/32.png) [@sWo0p](https://forum.kirupa.com/u/sWo0p)
#### Post date: [August 3, 2004, 12:09pm UTC](https://forum.kirupa.com/t/movieclip-code-help-please/118036/5 "2004-08-03T12:09:41Z")

</div>

ppl will do anything to get help ☹ _BUT_ read the rules… 🙂
