Hi,
just solved the problem with this code in JewelExample changing to "CHANGE"
event:
import vos.NavigationLinkVO;
private function changeHandler(event:Event):void
{
var item:NavigationLinkVO = (event.target as Navigation).selectedItem as
NavigationLinkVO;
main.showContent(item.href);
drawer.close();
}
I think is more elegant than using MouseEvent, even probably the right way
to go.
But I think the problem it arise with MouseEvents, target, currentTarget
and itemClicked is still there. The problems I see are:
1.- itemClicked (and others of this kind) is not exposed in MXML for Lists,
Should this be added? If not maybe is hard to use it right?
2.- currentTarget in List elements is null, I think this is not right
I tried multiple ways to workaround this but nothing worked with MouseEvent
- Click handler in List, so I think others with better knowledge of how
events work and the underling components and implementation should take a
look at this and try to see if there's a problem as I say or maybe is me
missing something
btw, Drawer component is mostly done, although I want to do some more
things to make it more complete :)
thanks
2018-07-03 10:05 GMT+02:00 Carlos Rovira <[email protected]>:
> Hi Alex,
>
> taking into account the code from JewelExample I just posted. This code:
>
> private function clickHandler(event:MouseEvent):void
> {
> var renderer:INavigationRenderer = event.currentTarget as
> INavigationRenderer;
> trace(renderer);
> }
>
> shows a trace = null, whatever place you click on the renderer (in the
> subcomponents or directly in the renderer). event.target is right but only
> in the renderer as expected.
>
> So it seems currentTarget is not working right at least in List component.
>
> Thanks
>
>
> 2018-07-03 4:10 GMT+02:00 Alex Harui <[email protected]>:
>
>> If event.currentTarget is not working, we need to make it work. That is
>> the recommended way to handle bubbling of events. The browsers and Flash
>> work that way so folks will expect it to work.
>>
>> The List's change event is not a bubbling event. Only interaction events
>> like Mouse and Keyboard events should bubble. There were lots of folks
>> overusing bubbling in old Flex code, but in Royale we should discourage
>> it. Instead each layer of the DOM should dispatch an appropriate
>> higher-level semantic event. IOW, while you can "click" anywhere in an
>> item renderer, logic in the item renderer gets to determine whether to
>> dispatch a higher-level semantic event like "itemClick" and "itemClick"
>> events should not bubble. Some higher-level layer might listen for
>> "itemClick" and turn it into "rowClicked" for a DataGrid, and even
>> higher-level might turn that into "change" or "selectionChange".
>>
>> So, IMO, instead of trying some new mechanism, it would be better to
>> understand why currentTarget is not working for Mouse/Keyboard events, or
>> add the code to propagate semantic events up the parent chain.
>>
>> My 2 cents,
>> -Alex
>>
>> On 7/2/18, 2:44 PM, "[email protected] on behalf of Carlos
>> Rovira" <[email protected] on behalf of [email protected]>
>> wrote:
>>
>> Hi Yishay,
>>
>> thanks for let me know about it. I'm playing with it but I didn't get
>> to
>> work.
>> The case is that maybe List component is not ready for this yet.
>>
>> * event.currentTarget seems not exists in ItemRenderers
>> * I can use "itemClicked" event in a MXML List (I think is not set the
>> metadata and the rest of wiring)
>> * List change event doesn't work as well.
>>
>> Hope you or other could point me to a more elegant solution since
>> right
>> now, since for me the actual solution is a hack that must be
>> converted to
>> something more final.
>>
>> Thanks
>>
>>
>>
>> 2018-07-02 16:38 GMT+02:00 Yishay Weiss <[email protected]>:
>>
>> > Take a look at ItemRendererMouseController.handleMouseUp() in
>> Basic. It
>> > uses currentTarget.
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > ________________________________
>> > From: [email protected] <[email protected]> on behalf
>> of
>> > Carlos Rovira <[email protected]>
>> > Sent: Monday, July 2, 2018 5:27:08 PM
>> > To: [email protected]
>> > Subject: List Item renderer Click event finds a component in its way
>> >
>> > Hi,
>> >
>> > what's the best way to handle a click event in a List when the Item
>> > renderer has some components that can interfere in the click event?
>> >
>> > I have an icon and a Label in the item renderer and if I click on
>> one of
>> > those "event.target" is logically set to this components.
>> >
>> > How to make "event.target" always resolve to the item-renderer,
>> even if I
>> > click in the label or the icon.
>> > If the label or the icon has a click event, then clicking on one of
>> those
>> > components should call it's own click handler, but if nothing is
>> set up, a
>> > click in any part of the renderer should call the list click event
>> handler.
>> >
>> > In JS I can set pointer-events : none for sub components in item
>> renderers
>> > but does not seems the best way to handle this
>> >
>> > thanks
>> >
>> > --
>> > Carlos Rovira
>> > https://na01.safelinks.protection.outlook.com/?url=http%3A%
>> 2F%2Fabout.me%2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.
>> com%7C6a108592eeb643ebcf2b08d5e0650676%7Cfa7b1b5a7b34438794a
>> ed2c178decee1%7C0%7C1%7C636661646889224052&sdata=YbiK4qjpjqC
>> pxmvP%2BHBytWFauyvIL%2BloI7dxNOF6lew%3D&reserved=0
>> >
>>
>>
>>
>> --
>> Carlos Rovira
>> https://na01.safelinks.protection.outlook.com/?url=http%3A%
>> 2F%2Fabout.me%2Fcarlosrovira&data=02%7C01%7Caharui%40adobe.
>> com%7C6a108592eeb643ebcf2b08d5e0650676%7Cfa7b1b5a7b34438794a
>> ed2c178decee1%7C0%7C1%7C636661646889224052&sdata=YbiK4qjpjqC
>> pxmvP%2BHBytWFauyvIL%2BloI7dxNOF6lew%3D&reserved=0
>>
>>
>>
>
>
> --
> Carlos Rovira
> http://about.me/carlosrovira
>
>
--
Carlos Rovira
http://about.me/carlosrovira