You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Peter Ent <pe...@adobe.com> on 2015/01/07 13:26:02 UTC
[FlexJS] Listening for mouse events
I'm trying to receive mouseover events on a FlexJS object whose element is a <div>. I've discovered this code in
org.apache.flex.events.EventDispatcher.prototype.addEventListener:
/**
* A bit of a hack, but for 'native' HTML element based controls, we
* want to listen to the 'native' events from the element; for other
* types of controls, we listen to 'custom' events.
*/
source = this;
if (this.element && this.element.nodeName &&
this.element.nodeName.toLowerCase() !== 'div' &&
this.element.nodeName.toLowerCase() !== 'body') {
source = this.element;
}
goog.events.listen(source, type, handler);
Since my source (a FlexJS class instance) has a .element of div, the source is being passed, as is, to goog.events.listen but since the event type is a "mouseover", I don't see it being handled. I'm thinking this "hack" isn't the way to go in all cases. Any suggestions?
Thanks,
Peter Ent
Adobe Systems
RE: [FlexJS] Listening for mouse events
Posted by Kessler CTR Mark J <ma...@usmc.mil>.
Should there be a general property added to the AS classes that passes the JS/html equivalent?
-Mark
-----Original Message-----
From: Erik de Bruin [mailto:erik@ixsoftware.nl]
Sent: Wednesday, January 07, 2015 7:44 AM
To: dev@flex.apache.org
Subject: Re: [FlexJS] Listening for mouse events
That 'hack' seems vaguely familiar... ;-)
In your source's inheritance chain, is there either a base class
'goog.ui.component' or 'goog.ui.control'?
EdB
On Wed, Jan 7, 2015 at 1:26 PM, Peter Ent <pe...@adobe.com> wrote:
> I'm trying to receive mouseover events on a FlexJS object whose element is a <div>. I've discovered this code in
>
> org.apache.flex.events.EventDispatcher.prototype.addEventListener:
>
> /**
> * A bit of a hack, but for 'native' HTML element based controls, we
> * want to listen to the 'native' events from the element; for other
> * types of controls, we listen to 'custom' events.
> */
> source = this;
> if (this.element && this.element.nodeName &&
> this.element.nodeName.toLowerCase() !== 'div' &&
> this.element.nodeName.toLowerCase() !== 'body') {
> source = this.element;
> }
>
> goog.events.listen(source, type, handler);
>
> Since my source (a FlexJS class instance) has a .element of div, the source is being passed, as is, to goog.events.listen but since the event type is a "mouseover", I don't see it being handled. I'm thinking this "hack" isn't the way to go in all cases. Any suggestions?
>
> Thanks,
> Peter Ent
> Adobe Systems
--
Ix Multimedia Software
Jan Luykenstraat 27
3521 VB Utrecht
T. 06-51952295
I. www.ixsoftware.nl
Re: [FlexJS] Listening for mouse events
Posted by Alex Harui <ah...@adobe.com>.
Peter, try syncing up to the repo. The hack has been ‘improved’ and
should give you what you need.
-Alex
On 1/7/15, 4:44 AM, "Erik de Bruin" <er...@ixsoftware.nl> wrote:
>That 'hack' seems vaguely familiar... ;-)
>
>In your source's inheritance chain, is there either a base class
>'goog.ui.component' or 'goog.ui.control'?
>
>EdB
>
>
>
>On Wed, Jan 7, 2015 at 1:26 PM, Peter Ent <pe...@adobe.com> wrote:
>> I'm trying to receive mouseover events on a FlexJS object whose element
>>is a <div>. I've discovered this code in
>>
>> org.apache.flex.events.EventDispatcher.prototype.addEventListener:
>>
>> /**
>> * A bit of a hack, but for 'native' HTML element based controls, we
>> * want to listen to the 'native' events from the element; for other
>> * types of controls, we listen to 'custom' events.
>> */
>> source = this;
>> if (this.element && this.element.nodeName &&
>> this.element.nodeName.toLowerCase() !== 'div' &&
>> this.element.nodeName.toLowerCase() !== 'body') {
>> source = this.element;
>> }
>>
>> goog.events.listen(source, type, handler);
>>
>> Since my source (a FlexJS class instance) has a .element of div, the
>>source is being passed, as is, to goog.events.listen but since the event
>>type is a "mouseover", I don't see it being handled. I'm thinking this
>>"hack" isn't the way to go in all cases. Any suggestions?
>>
>> Thanks,
>> Peter Ent
>> Adobe Systems
>
>
>
>--
>Ix Multimedia Software
>
>Jan Luykenstraat 27
>3521 VB Utrecht
>
>T. 06-51952295
>I. www.ixsoftware.nl
Re: [FlexJS] Listening for mouse events
Posted by Erik de Bruin <er...@ixsoftware.nl>.
That 'hack' seems vaguely familiar... ;-)
In your source's inheritance chain, is there either a base class
'goog.ui.component' or 'goog.ui.control'?
EdB
On Wed, Jan 7, 2015 at 1:26 PM, Peter Ent <pe...@adobe.com> wrote:
> I'm trying to receive mouseover events on a FlexJS object whose element is a <div>. I've discovered this code in
>
> org.apache.flex.events.EventDispatcher.prototype.addEventListener:
>
> /**
> * A bit of a hack, but for 'native' HTML element based controls, we
> * want to listen to the 'native' events from the element; for other
> * types of controls, we listen to 'custom' events.
> */
> source = this;
> if (this.element && this.element.nodeName &&
> this.element.nodeName.toLowerCase() !== 'div' &&
> this.element.nodeName.toLowerCase() !== 'body') {
> source = this.element;
> }
>
> goog.events.listen(source, type, handler);
>
> Since my source (a FlexJS class instance) has a .element of div, the source is being passed, as is, to goog.events.listen but since the event type is a "mouseover", I don't see it being handled. I'm thinking this "hack" isn't the way to go in all cases. Any suggestions?
>
> Thanks,
> Peter Ent
> Adobe Systems
--
Ix Multimedia Software
Jan Luykenstraat 27
3521 VB Utrecht
T. 06-51952295
I. www.ixsoftware.nl