Pan and Zoom in OpenFL howto

I would like to develop a pan and Zoom component for a project, anyone can guide me to some tutorials, resources or places to start with

Perhaps you can use a Sprite container and change the x, y, scaleX and scaleY of that container to handle your pan and zoom

If you want to do it smoothly you can use Actuate (or another tween library)

For panning I tend to detect when there’s a MouseEvent.MOUSE_DOWN and log the mouseX and mouseY to a Point. If MouseEvent.MOUSE_MOVE happens when the user still has the left mouse button pressed, I detect if it’s moved past a certain threshold (10 or 20 pixels) before I adjust the target Sprite’s position to cover the difference and then I call the “startDrag()” function.

For zooming, I grab the target Sprite’s mouseX and mouseY are at the time of zoom (or if this is done through “+” and “-” button, do a globalToLocal to for the center of the screen). I then scale up/down the target Sprite, detect how far away the current coordinates are from the previous coordinates I grabbed, and then adjust the sprite until those coordinates line again.

Thank you for your valuable replies, they have given me an idea from where to start.