okay, i dint quite get what you are trying to do. So let me answer all the things that i think you are trying to do.
I dont think you intended to do this ?. This will always be (0-0-0) * = 0. since you set recx=recy = 0;
the rec will always be (0,0,0,0) since "rec" is not updated on zoomin\zoom out\mousedown etc.
and startDrag second parameter is used to set a rectangle (parents coordinates) in which the whole image would be able to move on.
I guess you want to have a boundary, and if you drag some part of the image will probably not be visible ?
Like the below:
If you want to do something like the above then you need to use a MASK layer. Please read about mask.
Please let me know what you wanted to do, probably some screenshots....that will be useful.
Thanks for your reply, however (recX-recX-(recX))*2 (or something similar) is what I want to do as the recX & recY values do get changed each time you click on the zoomIn or zoomOut buttons. They get changed to the values by the localToGlobal method. I have done traces on the values and they are exactly what I expect them to be each time the button is clicked. They only get reset back to 0 when you click on the btnReset button.
I want to be able to move the whole image, as is it that image that gets zoomed in on and becomes bigger than the stage size, so I need to be able to move it around. I have managed to do it with a simple single zoom (doubles the image size in one go) though when I try to have multiple zoom levels, it is this that causes the issue!
Something similar to the link below! though without the thumbnail or the scroll buttons (for now anyway, I might add them in afterwards though)
Yes, for the kind od animation in the link you would have to use mask movieclip on top of the original image.
And the "rec" that you provide in the startDrag should be slightly larger then the image size itself, so that the image has some space to move.
rec should not be equal to the image size (x,y,width,height).
To learn about mask, chk this link
OK, was not too sure that I could use a MASK like that, I thought (being a newbie to Flash) that MASK's could only be used if the image in the background (in this case on the stage) was static and the MASK was dragged around. I did not realise that the MASk could be static and the background could be dragged about. Though if I still have to set the boundary for the "Rec" why do I need to use a MASK, why can I not still use the method I was using? I will look at the mask tutorials you set through and let you know how I get on!
The work that you are trying to achieve is like seeing, an image through a window. Here the window is a mask. and if the image is big then you should be able to drag and see within the bounds of the window (not the image).
The startDrag paramater is just used to tell where all you can drag the image, for example, in a game, i dont want somebody to drag and object from the left side of the screen to the right, then i can use the parameter and I guess its not the right use case for you.
Hope this helps
P.s. If this helps, please mark the post as answered.
I managed to get it to work without having to use the MASK option in the end without too much trouble!
The problem was with the button identifier I had used, putting them all into one function and using the Case"" to determine what button had been called was the fault. Separating them into individual functions worked a treat!
Thank you very much for you time and patience - I am going to look into the mask option (when I have time) just to see if it could neaten up my code though!