# Duplicating movieclips & Making draggable?

**URL:** <https://forum.kirupa.com/t/duplicating-movieclips-making-draggable/18415>\
**Category:** Uncategorized\
**Created:** [April 16, 2003, 4:04pm UTC](https://forum.kirupa.com/t/duplicating-movieclips-making-draggable/18415 "2003-04-16T16:04:57Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![1111](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/1111/32/206_2.png) [@1111](https://forum.kirupa.com/u/1111)\
**Post date:** [April 16, 2003, 4:04pm UTC](https://forum.kirupa.com/t/duplicating-movieclips-making-draggable/18415/1 "2003-04-16T16:04:57Z")

</div>

Okies, here it is folks…

firstly, plz accept my lack of Flash knowledge, I am basically trying to duplicate a movieclip by using a button… (no probs there).

however, i want to drag each movie clip individually… ( my brain froze)

Can anyone plz help me out?  
here is my butchered code…  
// graphic is the mc i wanna drag, n is the textfield that i want to count up.

on (press) {  
addmore = “graphic” add n;  
duplicateMovieClip(“graphic”, addmore, n);

```
n = Number(n)+1;
set(addmore add ":n", n);

// i tried the following, .... no luck
// myMovieClip .startDrag(true);

```

}

Any takers??  
:beam: Thanks…

---

<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:** [April 17, 2003, 5:18am UTC](https://forum.kirupa.com/t/duplicating-movieclips-making-draggable/18415/2 "2003-04-17T05:18:24Z")

</div>

This is the code i just made:  
[AS]  
\_root.box.onRelease = function() {  
duplicateMovieClip(\_root.box, “newbox”, 1);  
setProperty(“newbox”, \_x, 0);  
\_root.newbox.onPress = function() {  
startDrag(newbox, true);  
};  
\_root.newbox.onRelease = function() {  
stopDrag();  
};  
};  
[/AS]

box is the instance of the already made thing, and i called the duplicated box ‘newbox’. THis should be what you need 🙂

---

<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:** [April 17, 2003, 6:20am UTC](https://forum.kirupa.com/t/duplicating-movieclips-making-draggable/18415/3 "2003-04-17T06:20:49Z")

</div>

🙂 thanks a heap Blah!.  
i really appreciate ur time!

I am jus gonna check it… :chinaman:

---

<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:** [April 17, 2003, 7:37am UTC](https://forum.kirupa.com/t/duplicating-movieclips-making-draggable/18415/4 "2003-04-17T07:37:14Z")

</div>

I tried ur code. Works nice, but I need to create or delete the box’s. bascally, I want to add or minus boxes and be able to position in a room.  
When i try it, it replicates just once .  
is this the right usage?..

on (release) {  
\_root.box.onRelease = function() {  
duplicateMovieClip(\_root.box, “newbox”, 5);  
setProperty(“newbox”, \_x, 0);  
\_root.newbox.onPress = function() {  
startDrag(newbox, true);  
};  
\_root.newbox.onRelease = function() {  
stopDrag();  
};  
};  
}

Thanks in advance…  
:beam: [SIZE=1]

---

<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:** [April 17, 2003, 8:08am UTC](https://forum.kirupa.com/t/duplicating-movieclips-making-draggable/18415/5 "2003-04-17T08:08:48Z")

</div>

do you want it to add boxes automatically or somethign? or like when you press a button? not really sure what you want 😕

---

<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:** [April 17, 2003, 8:39am UTC](https://forum.kirupa.com/t/duplicating-movieclips-making-draggable/18415/6 "2003-04-17T08:39:38Z")

</div>

here’s the basics … 🙂  
Imagine an overview of a room. I want to add objects in the room, ie tables, sofa’s etc.  
there will be a + or - button for all objects in the room, to add more or delete the number of objects.  
All objects, tables sofa’s etc need to be able to drop & drag where u like in the room.

I have the action to make the room whatever size needed, and drop & drag onto an object, but this is hurting my noodle a bit. I am trying to create a virtual room.

I want to upload this once done, as i think it will benefit a lotta ppl like me.

Thanks 4 ur interest 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:** [April 17, 2003, 8:42am UTC](https://forum.kirupa.com/t/duplicating-movieclips-making-draggable/18415/7 "2003-04-17T08:42:54Z")

</div>

why do you need add and minus buttons if you have drag and drop?

This is what i think you want:

you want a selection of items in like a box, and a room next to it. You can then pull items from that box and drop them on the room is this correct?

---

<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:** [April 17, 2003, 8:55am UTC](https://forum.kirupa.com/t/duplicating-movieclips-making-draggable/18415/8 "2003-04-17T08:55:41Z")

</div>

🙂  
Thanks, thats a A much better way to do it… like i said ima bit of a flash doofus.

I got the duplicate & drag nice jus then, minus still to come, but ur idea is a much better method. So yeah, have a box of objects, which u can drag into a floorplan, to be able visualize, say what a function would look like… Ie “I have 100 guests, my room is 20m x 10m , therefore if i drag in 10 tables (to scale) and 3 sofas i can visualize the room space”

thanks again!.  
U r a legend! (-:

---

<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:** [April 17, 2003, 9:09am UTC](https://forum.kirupa.com/t/duplicating-movieclips-making-draggable/18415/9 "2003-04-17T09:09:28Z")

</div>

sorry i’m confused 😕 but i’ll see if i can make the way i said before, and we’ll make changes after that alright? oh yea btw, do you want a fixed number of objects you can drag? so like maximum 3 sofas until they’re all used up?

---

<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:** [April 17, 2003, 9:18am UTC](https://forum.kirupa.com/t/duplicating-movieclips-making-draggable/18415/10 "2003-04-17T09:18:39Z")

</div>

Hi Blah,  
Sorry 2 confuse u…  
U r pretty much have the concept correct.  
So, we have a box (room) on the left… On the right we have a “store” box of draggable-addon items ( with table/sofa/stage etc).  
We want to drag a sofa from our 'store" onto our “room” so we can get a visual reference of “virtual space”  
I think the idea of "only a few amount of certain items (like sof’s) would be an advantage, but not on all items.  
…

# .:®:. hands Blah a virtual beer. 🙂

---

<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:** [April 17, 2003, 9:21am UTC](https://forum.kirupa.com/t/duplicating-movieclips-making-draggable/18415/11 "2003-04-17T09:21:09Z")

</div>

heh alrite…i’ll see if i can get one to work 😕 SHouldn’t be within an hour though cause i’m workin on some homework but i’ll get it as soon as possible 🙂

---

<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:** [April 17, 2003, 9:23am UTC](https://forum.kirupa.com/t/duplicating-movieclips-making-draggable/18415/12 "2003-04-17T09:23:45Z")

</div>

Thanks m8!  
If I can give u any skills I have let me know, ie 3d etc…  
I 2 am afk 4 a few hrs, so any reply would be gr8!. grab my email @ ur leisure if needed…

thanks… :crazy:

---

<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:** [April 17, 2003, 4:10pm UTC](https://forum.kirupa.com/t/duplicating-movieclips-making-draggable/18415/13 "2003-04-17T16:10:15Z")

</div>

Oh well here it is, it was harder than i expected :-\ So then i had to get help from other people from this board, and lots of the code was thanks to kax 🙂

anyways, heres your code. The getbounds thing sorta works and sorta doesn’t, but i’m too sleepy so i’ll just post the fla now.

---

<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:** [April 18, 2003, 5:31am UTC](https://forum.kirupa.com/t/duplicating-movieclips-making-draggable/18415/14 "2003-04-18T05:31:41Z")

</div>

hey Thanks A Bunch Blah & Kax …  
okies, I have a similar working, but mine is on press, not bounds. This is gonna go a long way, so i will post it up as a tute in a few weeks when finished.

Take care guys & thanks 2 all!..  
:chinaman:

---

<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:** [April 18, 2003, 7:42am UTC](https://forum.kirupa.com/t/duplicating-movieclips-making-draggable/18415/15 "2003-04-18T07:42:02Z")

</div>

bounds? How is yours done with just on press? getbounds just gets the area where it can drop the box…oh well, anyways no problem 🙂
