0

I developed a mobile app inside Adobe Flex (4.6) and it includes using pinch-to-zoom functionality to zoom in on pictures to make it easier to read words in the pictures. In previous android versions (2.1 to 2.3.3 and 2.3.4 if you're running cyanogenmod) the pinch-to-zoom works fine. But if the app is run on an ICS (Android 4.x) device, the axes seem to handle the enlargement of the picture individually. i.e. when you move your fingers apart horizontally, the image gets very wide, but stays the same vertical size, and vice versa.

First, does anyone know why this is happening?

And second, does anyone know of a way to fix it to work as it did before?

I will update to include screenshots.

Update: I have confirmed this is also an issue with Honeycomb. i.e., 3.x OS acts the same as 4.x ICS.

Sense, running the latest HTC update: Original imagePinch-to-Zoompinch-to-zoom-out

ICS, on AOKP, but verified this is an issue with standard ICS distros as well: ICS pinch-to-zoom stretchcan stretch any way...gets a little disorienting

ketan
  • 19,129
  • 42
  • 60
  • 98
jlehenbauer
  • 599
  • 2
  • 11
  • 33
  • ha as you can see, the ics rom pulls battery pretty quickly. – jlehenbauer May 23 '12 at 16:38
  • Have you written the code for pinch-zoom yourself or is it part of Adobe Flex? If it is, then my guess is that they're the ones to blame for not having updated the code to work on newer versions of Android. – Michell Bak May 24 '12 at 15:16
  • yeah, part of flex :/ that would be a crazy bummer! – jlehenbauer May 24 '12 at 17:24
  • How does it work in landscape mode? And what about reverse portrait and landscape? Android 3.0 brought some changes regarding orientation, and it might be that Flex uses this. My guess is that there's nothing you can do then - well, apart from writing the code that handles zooming yourself. – Michell Bak May 24 '12 at 19:39
  • yeah, i observed the 3.0 orientation things (landscape is regarded as portrait and vice versa), but the zooming doesn't work properly either way :/ do you know if you can have the app read the android version then? to say, if os version >= 3, don't implement pinch to zoom? – jlehenbauer May 24 '12 at 19:43
  • Sure, a simple boolean like this will tell you if it's running on Honeycomb (or later) or not: `private boolean runsOnHoneycombOrLater = android.os.Build.VERSION.SDK_INT > 10;` – Michell Bak May 24 '12 at 20:34
  • for some reason, i get a compiler error saying `android` in the `android.os...` is an undefined property. do you know why this would be? – jlehenbauer May 29 '12 at 18:39
  • Try writing Build.VERSION.SDK_INT and let it import android.os. Don't know why it'd say that though. – Michell Bak May 29 '12 at 19:38
  • now it says, `Access of undefined property Build` :( – jlehenbauer May 29 '12 at 20:04

1 Answers1

0

Solved this. Code was previously:

        protected function onZoom(e:TransformGestureEvent, img:Image):void
        {
                DynamicRegistration.scale(img, new Point(e.localX, e.localY), img.scaleX*e.scaleX, img.scaleY*e.scaleY);
        }

change the final e.scaleY to e.scaleX. This makes it scale based on only one portion of the zoom (in the x direction) and scales both X and Y accordingly. Not exactly perfect, but it works very well in practice.

Final code is this:

        protected function onZoom(e:TransformGestureEvent, img:Image):void
        {
                DynamicRegistration.scale(img, new Point(e.localX, e.localY), img.scaleX*e.scaleX, img.scaleY*e.scaleX);
        }
jlehenbauer
  • 599
  • 2
  • 11
  • 33