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

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.

Related

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.

How does Chrome developer tools emulate touch events?

I have tried a few different Javascript tools/hacks/frameworks that emulates touch events on a PC, but none does it as flawlessly as Chrome's developer tools. How is it done? Can it be done as good as that with Javascript?
Let me give you an example to illustrate what I mean: I have built a webapp, exclusively for touch screens, containing a bunch of draggable elements. Now I also want to make it available for ordinary web browsers. The simplest way to do this is to use a small Javascript framework that maps mouse events to touch events, like touche.js. The problem with this approach is that if I drag fast, the mouse pointer will move out from the draggable, which then immediately stops. When I use Chrome's built-in emulated touch events (in Developer Tools), this never happens. I can drag as fast as I want. The code is exactly the same, except for the framework.
Do you have any ideas why this is happening, and if there is any remedy to the problem?
Probably on a lower level than javascript. Try a search for touchstart in the chromium code base and you can see that it's mostly C++ code :(

Paint on Canvas in Android's browser, page scroll?

I'm trying to make a canvas where the client can sign his name. It works well in Chrome v6:
but on Android 1.5 instead of drawing the browser scrolls the page and draws nothing:
I borrows the code from Opera's website.
Can I disable the scrolling or how can I make this work?
Thank you!
EDIT
using the events touchstart, touchmove and touchend:
on a LG GW620R using a stylus:
on a Motorola Milestone:
on a Samsung Galaxy:
EDIT 2
works better whitout using the finger nail
#Sirber There might be touchstart and touchend events just like in mobile Safari, have a look at that avenue too. And maybe if you adjust the viewport meta tag there won't be any scrolling, still won't draw but at least it won't scroll.
Good luck,
Mathieu
You're comparing the bleeding-edge in-development Chrome version to a stable 1.5 year old release of a parallel Webkit-based browser... of course there's better support for new HTML5 features in the much-newer experimental browser :) How does it render in a recent Android release (say, 2.2)? How about iOS?
There are definitely nontrivial differences between HTML5 browser support among Android releases (not to mention non-standard browser releases by HTC in SenseUI and the like). Check out the WebKit comparison chart at Quirksmode.
As far as viewport settings and disabling scrolling, Android's Webkit listens to most of the same settings that iPhone Safari does, and Apple has pretty good documentation on the settings you can use to tweak that.
You also may find this quirksmode post about supported events in mobile Safari helpful.
Canvas with iOS is really better (performances). Android browsers are far behind (doesn't work with opera-mini).
If you want to see the difference, just try with http://webdemo.visionobjects.com/ .
I'm just doing a quadratic smoothing for an handwriting input method with the HTML5 canvas-element.
tested with iPad1 & Motorola Xoom

Do Android/webOS devices support multi-touch Javascript events?

On iPhone, iPod touch and (presumably) iPad, Apple has multi-touch event handling available via JavaScript in Mobile Safari. I know the Nexus One recently added multi-touch support via an update, and I believe webOS is also multi-touch enabled. Do Android 2.1 and/or webOS have access to multi-touch in the browser, or is this currently exclusive to Apple devices?
The best master tracking for touch events (other than multi-touch! - answered above) appears to be:
http://quirksmode.org/mobile/tableTouch.html
Right now, Android 2.1 gets you pinch/zoom, but that's it. There's no fine-grained multi-touch tracking, like you get on iPhone.
UPDATE: MAY 2011 - Android Honeycomb 3.0 and 3.1 browsers now have proper multitouch
Please star this bug on the Android bug list:
http://code.google.com/p/android/issues/detail?id=11909
Let's see if we can raise awareness of this issue.
On Palm webOS, you can get multiple touch events. You can receive up to five touch points at one time.
If you're doing native development using the PDK, handling multiple touches is described at http://developer.palm.com/index.php?option=com_content&view=article&id=1980&Itemid=337. Each finger is tracked as a separate mouse in the SDL events.
For Javascript developers using the standard SDK, there events that are sent to indicate that two fingers are in use. "gesturestart" fires when the user puts 2 fingers on the screen, usually to pinch or rotate, "gesturechange" fires when 1 or both fingers move on the screen, and "gestureend" fires when the fingers are lifted from the screen. These aren't well documented on the Palm developer site, but they're used in the mojomatters sample code.
Edit: looking at your question again, there is no "touch" event support in the browser on WebOS for applications delivered through web sites.
It depends on the browser. The browser on the HTC Hero, which currently runs Android 1.5 and HTC's customised TouchFlo interface, has always had multitouch. The 'Dolphin' browser has also had multitouch since before the Android 2 update. That said, I've never tried using the multitouch for anything but 'pinch zoom' so it might not work with a specific Javascript or something like that.
It depends on the device. But I think the current Android 2.x device got all multitouch.
On the Samsung Galaxy Tab I have tried the Android 2.2 Browser, Dolphin HD 4 and Opera Mini 5. The closest implementation to what I'm looking for is http://anders.com/cms/352/OpenLayers/iPhone/Android/Touch.Gestures (demo ending in '/touchmaps' on that page) which works with the Android 2.2 browser. This does touch pan only with the Android device but no pinch zoom gesture capture in Javascript which is what I really need.
Firefox 4 has the best working and best documented javascript multi-touch API. This is currently implemented in Firefox 4 beta 3 (unfortunately only on Windows 7). I have FF4 beta 2 running on the device but it doesn't have the multi-touch support yet.
I am hoping FF4 b3 for the Android will do what I want, and that the other browser implementation will follow suit. Until then it's just a wait and see.

How to handle drag events on iphone and ipad with javascript/jquery?

I have a little app that has been under development for some time. My friends and I have been working really hard on this and are near release of the beta version.
I want to give some demos using iPhone and iPad to look cool :p
Now my problem is how to handle:
Mouse Down
Mouse Up
Mouse Leave
The multitouch interface of the iPhone (which I expect is similar to the iPad) handles mouse move on a browser has a scrolling event. One could try to capture the scrolling event and use it to simulate the dragging but I don't even know if it will be doable or if it will only be a hack.
Any one knows of a more robust manner to manage dragging events on the iphone/ipad?
Apple's Developer pages have a lot of good info on handling just these types of issues.
Handling Events
I was having the same problem and I realized that in the short time-span I had, developing codes to handle raw mouse (down, move and up) events would take time. So, I went ahead and modified the ThreeDumsMedia jQuery.event.drag plugin to make it to work on iPhone.
Get the jQuery.event.drag from http://www.shamasis.net/2011/06/javascript-drag-events-on-iphone-and-other-touch-based-devices/ and the 'drag' event would work just fine on iOS devices.
let me know if this helped.
Try this :
jquery.event.drag - v 2.2
Three Dub Media - http://threedubmedia.com
If you are using jQuery, then use jquery.ui.mouse.touch.js with jquery UI 1.9.

Categories