我需要找到一种方法来简单区分用户是否在AS3中具有Zoomed IN或Zommed OUT。
这不是关于放大或缩小图片。我想让用户放大文本以使其更大(FontSize ++)或缩小它以使其更小(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
}
亲切的问候, 阿里
答案 0 :(得分:2)
我通过创建实验性应用程序和Try and Error找到了答案。
为了告知将来可能有类似问题的用户,当我们捏住屏幕时,为了确定缩放是向内还是向外,为了执行基于此的功能,我们可以使用scaleX或scaleY,以及在这种情况下,这两个似乎没有区别!
结果:
以下是代码:
myTextBox.addEventListener(TransformGestureEvent.GESTURE_ZOOM , onZoom);
function onZoom(e:TransformGestureEvent):void {
if (e.scaleX > 1) {
fontSizeInc();
} else if (e.scaleX < 1) {
fontSizeDec();
}
}
由于