We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › How to do Drag (and eventually Drop:)
Page Index Toggle Pages: 1
How to do Drag? (and eventually Drop:) (Read 1335 times)
How to do Drag? (and eventually Drop:)
May 10th, 2005, 5:41pm
 
(i'm bad in english so please be merciful Smiley

I would like to drag a square or wathever u want, i cand do it easyly with actionscript, but with processing...
I tried something with the "mousePressed" like:
void draw() {
 if (mousePressed == true) {
mySquare.posX=mouseX;
mySquare.posY=mouseY;
"and here i put a method to show the square like:
mySquare.show();"
}

But... it doesn't work (of coarse ^^)
Can somebody make a good action and do a little and beautiful example?
Re: How to do Drag? (and eventually Drop:)
Reply #1 - May 10th, 2005, 6:01pm
 
have you tried my maus-lib ?

it's here ( + drag-drop example ):
http://bezier.de/maus/

let me know if it works for you .. or if you have questions.

F
Re: How to do Drag? (and eventually Drop:)
Reply #2 - May 10th, 2005, 6:35pm
 
tx 4 ur help Wink
But... i'm too newbie to use your work...
can't u do something more :s easy to understand Cheesy?
just...
a poor dummy square alone on the stage...
and when u clic, tadaaam the square sticks to the mouse.

that's all...
^^'
Re: How to do Drag? (and eventually Drop:)
Reply #3 - May 10th, 2005, 6:51pm
 
Processing works very differently from Actionscript for this type of work. Here's an example:
http://processing.org/learning/examples/mousefunctions.html
Re: How to do Drag? (and eventually Drop:)
Reply #4 - May 10th, 2005, 7:08pm
 
yes i saw this example, but...
in this case, u must be over the square to drag it.
I would like that wherever u click, the square come and stick to the mouse :s

but i'll study attentively this example this night, and i'll boring you again, tomorrow Wink
Page Index Toggle Pages: 1