PDA

View Full Version : Duplicating movieclips & Making draggable??



.:®:.
April 16th, 2003, 12:04 PM
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.......

blah-de-blah
April 17th, 2003, 01:18 AM
This is the code i just made:

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


box is the instance of the already made thing, and i called the duplicated box 'newbox'. THis should be what you need :)

.:®:.
April 17th, 2003, 02:20 AM
:) thanks a heap Blah!.
i really appreciate ur time!

I am jus gonna check it....... :chinaman:

.:®:.
April 17th, 2003, 03:37 AM
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]

blah-de-blah
April 17th, 2003, 04:08 AM
do you want it to add boxes automatically or somethign? or like when you press a button? not really sure what you want :/

.:®:.
April 17th, 2003, 04:39 AM
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!.. (-:

blah-de-blah
April 17th, 2003, 04:42 AM
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?

.:®:.
April 17th, 2003, 04:55 AM
:)
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! (-:

blah-de-blah
April 17th, 2003, 05:09 AM
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?

.:®:.
April 17th, 2003, 05:18 AM
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. :)

blah-de-blah
April 17th, 2003, 05:21 AM
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 :)

.:®:.
April 17th, 2003, 05:23 AM
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:

blah-de-blah
April 17th, 2003, 12:10 PM
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.

.:®:.
April 18th, 2003, 01:31 AM
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:

blah-de-blah
April 18th, 2003, 03:42 AM
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 :)

DllPkl
June 10th, 2004, 04:46 PM
Is your tute available yet for the dynamically adding movieclips and drag n dropping them in place ?

Some other options I was thinking about with this tute would be a controller/slider for scale, rotation, and color.

What if you were to drop in discriptions for the sofas and tables? Could you add in dynamic text boxes, add your text and select the size and font of that text box ?

Thanks for your help. I'm trying to tackle this same problem, only with the added options..

http://www.kirupaforum.com/forums/newreply.php?do=newreply&noquote=1&p=169529#

howardmedia
June 21st, 2004, 06:05 AM
Hi blah,

I am creating similar project to root.. I was wondering if you could toss the same code my way, having real trouble and need to finish asap.

cheers in advance.

blah-de-blah
June 21st, 2004, 08:46 AM
Hi blah,

I am creating similar project to root.. I was wondering if you could toss the same code my way, having real trouble and need to finish asap.

cheers in advance.

Well howardmedia I don't know why this was posted back then :-/, but here it is.

howardmedia
June 21st, 2004, 10:13 AM
Thanks for that. Sorry if I posted it wrong, newbie to the forum world.

Would you know how do go about attaching the boxes to the room mc. ie the room mc should also be draggable and scalable which I have done but cant seem to get an mc to stick to were I drop i, when I use attachMovie it always goes to 0,0 intead of the xy of the mouse, just not sure on the req code.

cheers

blah-de-blah
June 21st, 2004, 11:41 PM
Thanks for that. Sorry if I posted it wrong, newbie to the forum world.

Would you know how do go about attaching the boxes to the room mc. ie the room mc should also be draggable and scalable which I have done but cant seem to get an mc to stick to were I drop i, when I use attachMovie it always goes to 0,0 intead of the xy of the mouse, just not sure on the req code.

cheers

So do you just want what i gave you but with a scalable function? I'll try and see if I can do that...