flex - How to find the graphic primitive that is clicked in a group -
i have group has many different graphic primitives in it. if click on group can reference in mouseevent(event).currenttarget. how know if have clicked on graphic primitive?
example code:
<?xml version="1.0" encoding="utf-8"?> <s:application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minwidth="955" minheight="600"> <fx:script> <![cdata[ protected function group1_mousedownhandler(event:mouseevent):void { trace("event target="+ event.target); // traces group } ]]> </fx:script> <s:group width="500" height="500" horizontalcenter="0" verticalcenter="0" mousedown="group1_mousedownhandler(event)" mouseenabledwheretransparent="true"> <s:rect x="10" width="100" height="100" radiusx="10" radiusy="10"> <s:fill> <s:solidcolor color="#ff0000"/> </s:fill> </s:rect> <s:ellipse x="150" width="100" height="100"> <s:fill> <s:solidcolor color="#ff0000"/> </s:fill> </s:ellipse> </s:group> </s:application>
the classes in package spark.primitives not inherited interactiveobject, won't dispatch mouse event. add them different groups, 1 one. , add listeners groups.
Comments
Post a Comment