[flexcoders] Mouse click drop

2009-02-09 Thread smitade
I'm developing an app with click and drop as opposed to drag and drop.
I have a bunch of images on a canvas. When I click an image it adds a
MOUSE_MOVE event listener to the canvas. I then relocate the image
based on the canvas mouseX and mouseY movement. This event is removed
when I click the mouse a second time. As you can understand, this work
well if the image stays under the mouse, but goes haywire when the
mouse is moved over other images or if you move the mouse too quickly.
I could disable all the other objects on the canvas from responding to
the mouse movement but is there a better way to go about this.



RE: [flexcoders] Mouse click drop

2009-02-09 Thread Alex Harui
You'll see other Flex code for MOUSE_MOVE usually uses capture phase when 
calling addEventListener

Alex Harui
Flex SDK Developer
Adobe Systems Inc.http://www.adobe.com/
Blog: http://blogs.adobe.com/aharui

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of smitade
Sent: Monday, February 09, 2009 12:52 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Mouse click  drop


I'm developing an app with click and drop as opposed to drag and drop.
I have a bunch of images on a canvas. When I click an image it adds a
MOUSE_MOVE event listener to the canvas. I then relocate the image
based on the canvas mouseX and mouseY movement. This event is removed
when I click the mouse a second time. As you can understand, this work
well if the image stays under the mouse, but goes haywire when the
mouse is moved over other images or if you move the mouse too quickly.
I could disable all the other objects on the canvas from responding to
the mouse movement but is there a better way to go about this.