Thanks Benjamin. That's some good stuff. Way beyond me, I think. ;)
Here's a little more info about the problem I'm facing. It's pretty
unique and edge-casey, but maybe you'll find it interesting.
I'm prototyping a graphical widget that appears when you mouse over
the album art on a song slide. I want to make the widget disappear
when you mouse away. Typically, this would be as easy as catching an
onmouseout and hiding the widget. And flash supports that, even when
you mouse off the canvas -- you still get an onmouseout (yet the
reported mouse coordinates are still within the bounds of the object).
Here's the trick: this widget contains buttons that also receive
mouse events. Those buttons (of course) have hover effects and
various states, and clicking them may cause other objects to appear
above the buttons. The net result is that my widget may never
receive a mouseout event, because one of the buttons contained within
it may instead receive the mouseout.
What I've ended up doing is attaching event handlers to LzGlobalMouse
to catch all onmouseover/onmouseout events and check to see whether
or not the current mouse position is within the bounds of the the
widget. This is by far the easiest and most fullproof algorithm.
(Alternative would be to catch onmouseout of the contained buttons
directly, and then try to determine why a button received a mouseout,
and whether the event is worthy of hiding the container widget or
not. For various reasons, this line of thinking proved nearly
impossible to sort out.)
As I've thought about it, I've wondered if what I need is extra info
in the mouseout event that tells me which object is going to receive
the subsequent mouseover (or null if no object is going to get
mouseover). For example, something like:
<method event="onmousemove" reference="LzGlobalMouse" args="who,where">
// "who" is the object that received the mouseout event
// "where" is the object that the mouse has entered, or null
// if no object receives mouse events at the new location
if(who_is_the_widget_or_its_child()) {
keep_visible();
} else {
make_invisible();
}
</method>
I suppose I could implement this by setting a timer during onmouseout
to check what the subsequent onmouseover value is. The only problem
is that I don't know what contractual guarantees the runtime provides
with regard to mouse events and their proximity time-wise. If a
mouseout occurs, is any subsequent mouseover guaranteed to happen
before the next onidle? Is it possible for multiple mouseout/
mouseover combos to happen before the next onidle?
On May 26, 2006, at 12:43 AM, Benjamin Shine wrote:
> You might try applying a predictive tracking algorithm: something
> like watching every mouse move, guessing where the mouse is going,
> then setting a timer to see if you get another mouse move event.
> You could get into math like evaluating the rate of travel of the
> mouse pointer towards a boundary of the app; moving rapidly toward
> the border would predict that the border will be crossed; moving
> towards the border but decelerating would predict that the border
> won't be crossed.
>
> Patrick Baudisch, at Microsoft Research, has been doing some really
> nice CHI work with user studies on this sort of thing. I recommend
> checking out his work. It might not be exactly what you need, but
> it's *cool*, and could get you a "+5 nifty!" rating if you applied
> it to Pandora.
> http://www.patrickbaudisch.com/publications/index.html
>
> Joe Laviola at Brown has been doing some work with this:
> http://www.cs.brown.edu/people/jjl/ptracking/ptracking.html
>
> Is your app in a javascript wrapper, though? Seems like there ought
> to be a clever way of noticing a mouse-enter in DHTML, and sending
> a message to the laszlo app to let it know it's lost the pointer.
>
> Please let us know what you learn.
>
> On May 25, 2006, at 9:38 AM, Neil Mix wrote:
>
>> I'd like to have some way of knowing that the mouse is no longer
>> above the canvas, i.e. the Flash app is no longer able to receive
>> mouse events. Is this possible at all? What I'm seeing is that the
>> last moused-over object will receive a mouseout event, but the
>> getMouse() coords returned are the last known location of the mouse
>> before it left the canvas (which makes sense).
>>
>> I'm guessing I'm out of luck here, but I thought I'd check with the
>> experts first. It's OK by me if the solution involves using Flash
>> native or deeply private LZX stuff.
>>
>> TIA, -Neil
>> _______________________________________________
>> Laszlo-dev mailing list
>> [email protected]
>> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
>
> benjamin shine
> software engineer
> [EMAIL PROTECTED]
>
>
>
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev