Reputation: 127
I need to find a way to simply distinguish if the user has Zoomed IN or Zommed OUT, in AS3.
It is not about scaling up or down a picture. I want to let user Zoom in on a text to make it larger (FontSize++) or Zoom out on it to make it smaller (FontSize--).
myTextBox.addEventListener(TransformGestureEvent.GESTURE_ZOOM , onZoom);
function onZoom(e:TransformGestureEvent):void {
//if it is zoom in => call fontSizeInc
//if it is zoom out => call fontSizeDec
}
Kind Regards, Ali
Upvotes: 0
Views: 79
Reputation: 127
I found the answer by creating an experimental application and Try and Error.
To inform users that may have similar questions in the future, when we pinch the screen, in order to determine whether the zoom is going inward or outward, to execute a function based on that, we may use scaleX or scaleY, and seem there is no difference between these 2 in this case!
As a result:
Here is the code:
myTextBox.addEventListener(TransformGestureEvent.GESTURE_ZOOM , onZoom);
function onZoom(e:TransformGestureEvent):void {
if (e.scaleX > 1) {
fontSizeInc();
} else if (e.scaleX < 1) {
fontSizeDec();
}
}
Thanks
Upvotes: 2