Pinch, drag and zoom

I was looking for a good solution, but none seemed to work for me. So I started from scratch, and here's how I did (works only on iphone):
http://gamesalad.com/game/6207
On my iphone 4 it works like a charm!
http://gamesalad.com/game/6207
On my iphone 4 it works like a charm!
Comments
Or you can download the package here: http://goo.gl/psNxB
I suppose the third time will be good.
http://goo.gl/ADDwO
The answer was very simple. You want the image to zoom accordingly to distance from fingers, like if the image was glued to your fingertips. So the PROPORTION between the distance of fingers and the image size has to remain constant (I won't demonstrate this, since I'm not at school anymore).
How do we pinchzoom?
[New image width] = [previous image width]*[(updating finger distance)/(starting finger distance)]
Easy, isn't it?
How do we drag?
[new position] = [(previous position x)+(updating finger x)-(starting finger x)], [(previous position y)+(updating finger y)-(starting finger y)]
Et voilà, pinch, zoom and drag done the right way!