You should add a TOUCH_TAP event listener to each legend item, as displayed in the function MyLegendItem()
for mouse down event. Just add this line to the constructor:
addEventListener(TouchEvent.TOUCH_TAP,handleEvent);
You will have to change the event type on handleEvent
declaration to Event
instead of MouseEvent
, because TouchEvent
and MouseEvent
are not directly related.
Also, the syntax you've tried is not AS3, but rather JS or AS1 instead. You should first search for proper AS3 syntax to try.