Android: disable pinch zoom and pass event to Flash content - javascript

I have a flash application written in actionscript 2.0 that shows vector architectural maps and works perfectly on common web browsers. There are many interactions with javascript functions called by user events on the webpage, such as zooming to a certain x,y point. This event is usually accomplished via the mouse wheel.
Now I have to make sure that the thing works on tablet pc, in particular the Galaxy Tab. The first thing I have to fix is that, obviously, there is no mouse wheel and the user naturally tries to pinch zoom the flash application, with the result of zooming the entire web browser.
What I need is to listen to the multitouch gesture and, when a pinch zoom event is called, disable the default zooming event and call a javascript/flash function that allows my flash app to zoom only the objects that need to be zoomed: in few words, the browser stays still and only a part of the flash zooms in or out.
Consider that I am totally new to Android and that I already have working javascript functions to call flash object functions for the zooming purpose, so I just need to connect them to some android things that tell me when the user tries to pinch zoom in and when he tries to pinch zoom out (and possibly the x,y point of zoom).
Thanks a lot for your help!
Max (Italy)

Passing a JavaScript call from android to flash is a very very hard task as far as I know.
Not because of android (follow this tutorial http://code.google.com/p/openmobster/wiki/JavascriptBridge to pass a JavaScript call to a web page ), but because of flash securities for local content.
It is not too much of an issue on a local computer, but the flashplayer on android is very very buggy.
I think the best is to try to find an other solution if possible...

Related

Sending a tap to a Web application through VoiceOver

I am building a web application for use by visually impaired users to explore SVG diagrams via a tactile printout. In order to allow this I need to calibrate the tactile printout to the image on the device. Thus I need to be able to receive the x and y coordinates of a click when using a screen reader, specifically VoiceOver for iOS.
Using Talkback, I would tap and hold until I hear an audible click and then use my second finger to double tap and send clicks to the application itself from that position.
When using VoiceOver, I understand how to send swipes by tap and holding until a triple bell and then swipe. However, I cannot for the life of me find out how to send a positioned click.
On a side note, I am using Hammer.js.
Any ideas?
Thanks
As far as I can tell, this functionality was supplanted by the interactive drag-and-drop support added to VoiceOver in iOS 11.

How to avoid swipe scrolling and double tap zooming on android 2.3.6 stock browser?

I have this tetris game I programmed with the intention of learning a bit more on javascript: elcodedocle.github.io/tetrominos
I can play it in most tablet/smartphone browsers, but on my Android 2.3.6 stock browser (Samsung Galaxy Ace ST5830) it has two problems:
Zoom events are not exactly canceled by user-scalable=no viewport property: double click and two-finger zooming still work. Sometimes.
The canvas freezes, also sometimes (I'm going mad trying to determine the cause: How the heck you debug a web app running on an android browser??). I'm guessing because of a swipe or drag event triggered that shouldn't be, so it's somehow related to the above. Tapping out of the canvas makes it work again.
I'm using Kineticjs to manipulate the canvas and bind the touch events, on top of jquery-ui for the dialogs and jQuery (not jQuery mobile).
Any suggestions/ideas?
the problem is with the device's processing speed.. evrery device has its own processing speed. canvas animations are based on javascript's setInterval and setTimeout methods..which performs as per the device's processing speed..thats why canvas games are sometimes laggy on handhelds.

Pinch to Zoom using Google Maps Javascript API in Android Browser

Has anyone gotten pinch to zoom to work for a Google Map in the Android Browser? It works fine in Android applications and I hear it works in iPhone's Safari Browser but I'm interested in getting it to work in a web app that's viewed via the Android Browser. Currently you can pinch zoom in but the map does not redraw (i.e. it just gets larger and pixelated). You cannot pinch zoom out.
Edit: It seems to be different on each phone:
Evo - Problem discussed above
Epic - Pinch to zoom out works, zoom in has problem discussed above
Galaxy S - Pinch to zoom in and out both work fine
At the current time, Google Maps API v3 (and any other JavaScript code, for that matter) cannot rely on receiving events related to pinch-to-zoom in JavaScript on Android browsers. See http://code.google.com/p/android/issues/detail?id=11909
If this issue is important to you, I recommend logging in, starring the issue, and leaving a good comment.
For what it's worth, I have not run across this problem in Honeycomb, which makes me at least slightly hopeful that Ice Cream Sandwich will fix this for the phones.
It seems that Android doesnt support multitoches events for javascript. It support only touchstart/mode/end events, but not gesture events so it dont support zoom in out, (for me doesnt work even on galaxy s). Maybe in the android 3.0 they will add this event to browser.

How to disable mouse gestures as a developer?

I'm developing a web application and I noticed how irritating mouse gestures can be on it, so, is there a way to disable them (Firefox and Opera particularly)?
Edit: It seems there is some confusion. I'm developing a web based software that has an interface with such complex actions and tasks such as mouse selections, file drag and dropping, a desktop and a Windows Explorer -style filesystem. Whenever I try to select multiple virtual files and move them around, mouse gestures will apply and take me away from the software and navigate to the previous page or do something else nasty. My project is not a website, it's a web application -- mouse gestures are poison to this project.
You don't say you're using a library, but this is a jQuery plugin to detect gestures: http://plugins.jquery.com/project/jGesture
Looking at the source code, looks like it depends on measuring the action b/t mousdown and mouseup ... lotsa math.
And Mozilla offers some event handlers.. https://developer.mozilla.org/En/DOM/Mouse_gesture_events but it has a big Non-standard stamped on it.
the polite thing to do would be to inform users that to take full advantage of your site, they should disable mouse gestures temporarily.

Flash: Using mouse wheel events in full screen mode (Windows and Mac)

Although Flash has a mouse wheel event (MouseEvent.MOUSE_WHEEL), it comes with quite a few problems.
The first is that the event is not yet supported on the Mac. So there are a bunch of solutions, all of which (basically) capture the mousewheel (or DOMMouseScroll) event in javascript and pass it into the flash app. Luckily, under all the Mac browsers I tested, this also works when flash is in fullscreen mode.
Problem 2 is that flash ignores mouse wheel events with small "deltas". For example, Microsoft's IntelliPoint Mice with "Smooth Scroll" causes this problem. A solution to this is the same as the solution for the mac... i.e. capture the javascript mouse wheel event in the browser and pass it to the app. The issue is that of the browsers in windows that I tested (firefox, ie, safari, and chrome), they don't seem to capture this event when flash is in full screen mode. Does anyone know why or how to fix that?
I currently have a hybrid solution that always takes events from javascript (in non-fullscreen or fullscreen mode) except when it's in fullscreen mode on Windows (at which point it takes them from the flash mousewheel event). So the only times it fails is in full screen mode on Windows with a mouse that has small deltas. Anyone have a full solution? Or just a better one?
It's a know issue on adobe's JIRA. You need to wait'em to fix it, or use another event instead MouseEvent.MOUSE_WHEEL. It's not working on windows because the flash player implementation is completly different in windows from mac and linux. Mac and Linux uses GTK to implement the plugin Handle. On windows it uses a Win32API Common HWND, which steal focus on full screen mode, causing the non dispatching of scroll events on the browser. On Mac and Linux, GTK just stretch the plugin size into desktop's size, and don't do a real fullscreen. It's a GTK behavior inside these systems. Nothing can be done.
Your solution is one of the best. Only one is better - don't use mouse wheel :(
Adobe should do something with it (and with support for other controllers).
MouseEvent.MOUSE_WHEEL seems to work fine on mac since Gala beta and 10.1 final. i can trigger mouse wheel events using the magic mouse and track pad in both Safari and Chrome.
Pixelbreaker's MacMouseWheel has given me successful fullscreen scrolling on a mac, but I haven't used it in a while (on Safari 5 for example).
The downside is that it captures events for the whole page, so you will lose scrolling for the HTML even if the flash element is only a little box on the screen.
But you could basically switch between what you've built already, and what he's using in the macmousewheel.js when you've enabled full screen.
Hope that helps, good luck.
You could try using the simple AS3 class MacMouseWheelHandler at http://blog.earthbrowser.com/2009/01/simple-solution-for-mousewheel-events.html which makes it so you don't have to integrate with Javascrpt. It injects the Javascript right from Actionscript.

Categories