[
https://issues.apache.org/jira/browse/FLEX-34040?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13917626#comment-13917626
]
Borek Bernard commented on FLEX-34040:
--------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
protected function
group1_creationCompleteHandler(event:FlexEvent):void {
group1.addEventListener(MouseEvent.CLICK, group1_clickHandler);
group1.removeEventListener(MouseEvent.MOUSE_MOVE,
group1_mouseMoveHandler);
}
protected function group1_clickHandler(event:MouseEvent):void {
// this handler will not be invoked by group1 (no trace output
will be visible);
// toggle comment before line 11 to see trace output
trace("clicked");
}
protected function group1_mouseMoveHandler(event:MouseEvent):void {
}
]]>
</fx:Script>
<s:Rect width="200" height="200">
<s:fill>
<s:SolidColor color="gray" />
</s:fill>
</s:Rect>
<s:Group id="group1" width="200" height="200"
creationComplete="group1_creationCompleteHandler(event)">
</s:Group>
</s:WindowedApplication>
> GroupBase incorrectly computes hasMouseListeners which breaks e.g.
> mouseEnabledWhereTransparent
> -----------------------------------------------------------------------------------------------
>
> Key: FLEX-34040
> URL: https://issues.apache.org/jira/browse/FLEX-34040
> Project: Apache Flex
> Issue Type: Bug
> Components: Spark: Group
> Affects Versions: Apache Flex 4.11.0
> Reporter: Borek Bernard
> Attachments: Flex34040Demo.fxp
>
>
> The `GroupBase#hasMouseListeners` property is vital for things like
> dispatching mouse events on transparent parts on the group, however, the
> current algo is incorrect - it just increments a counter every time
> addEventListener() is called and decrements it when removeEventListener() is
> called.
> That means that when I call addEventListener("click") and then
> removeEventListener("someOtherMouseEvent"), the hasMouseListeners property
> will be false even though I have an active "click" listener.
--
This message was sent by Atlassian JIRA
(v6.2#6252)