Hi,
I'm using Actionscript 3, and am building an image viewer. So far, I have the following functionality, based around the "onClick" mouse event:
1) When viewing the normal sized image, clicking will display a "zoomed" image.
2) When viewing the zoomed image, clicking will display the "normal" image.
Great stuff.
Now I want to apply the following behaviour, so the user can zoom in, and drag the zoomed image around - and have sketched out the following:
1) Removed the onClick event
2) Add an "onMouseDown" event, to record the mouse XY on mouse down
3) Add a "onMouseUp" event, and record the mouse XY on mouse up
4) If the XY onMouseDown = XY onMouseUp then assume a Click event - so Zoom
5) If the XY onMouseDown != XY onMouseUp then assume a Drag event - so drag the image
Now this only works if the user has a steady hand while clicking - and doesn't feel like a great solution. If the user has an unsteady hand, a drag event is assumed when they really wanted to de-zoom...
Can anyone suggest a better way of detecting whether to Drag the image or to Zoom the image than I have sketched out above?
Thank you for your thoughts / help,
Senior coconut.