0

Hello guys/girls,

I am trying to make this flash game and I am running into a part that I have been stumped on and searching for the solution for the last hour. Basically its a "drag and drop" kind of game and when the user goes to click on an item (to drag it) I want it to create another instance that way the original item (that was clicked on) stays in place and they can select it again.

Thanks,
C.Huffman

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by JasonHippy
0

Hey there!

If I am following you correctly, one thing you could do I suppose is put two instances of your object onto the stage and use the bottom one as a placeholder (so it's not drag enabled.).
That way, when the user drags the top object off, there is an image underneath which makes it look as if there are more draggable objects on the stage underneath the one you're currently dragging.
If you grey the placeholder out, it makes it look as if the item has been disabled until the current drag operation has finished.

Once the current draggable item has been dropped into place, you can create a new draggable item over the top of the placeholder.
Or alternatively, if your draggable item disappears after it has been dragged and dropped, you can simply reset the draggable items position so it's placed directly over the placeholder (That way you'll only ever need one draggable object!).

As another alternative, if you know how many draggable objects you're going to need, you could stack several instances of your draggable objects on top of one another on the stage (use an array in your code) and get the user to drag 'em off one by one until the stack is empty.

So there are several different ways around it, it just depends exactly what you're after!

Cheers for now,
Jas.

P.S.
If this was of little or no help to you, is there any chance you can post some code or a zipped .fla with a detailed description of what you're trying to do?

Note: if you do post any .fla's here, please be sure to let us know what version of flash you're using as several of the regulars here have access to different versions of flash.

I have access to machines with mx2004 pro, 8 pro, CS3 pro and FlashDevelop installed on them, but not CS4....Yet!

0

Hello,

Thanks for your answer, the first method (placeholder that is grayed out, until the drag is completed) would work perfectly but the problem I have is how would I make AS3 create and place the new instance?

There won't be a set number of items the user will drag so I am not able to go with the specific number of items option.

Edited by chuffman: n/a

0

Well there's more than one way to do this, so how you're creating objects and placing them on the stage at the moment will determine the best way of going about things!

It would really help if we could see some of your code or better still your .fla.
Are you using instances of sprites/movieclips that have been dragged onto the stage from the library in your .fla? Or are you adding instances to the stage using only code? Or a mixture of both?

If you post some relevant code, we might be able to help!

Cheers for now,
Jas.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.