View Single Post
Old 02-08-2013, 04:17 PM   PM User | #2
djpaul1963
New Coder

 
Join Date: Apr 2012
Location: Athens GR
Posts: 58
Thanks: 0
Thanked 6 Times in 6 Posts
djpaul1963 is an unknown quantity at this point
You must add the mouse listeners to the buttons instead of the stage, like:

tile1.addEventListener(MouseEvent.CLICK, placeX);
tile2.addEventListener(MouseEvent.CLICK, placeX);
...

and
tile1.addEventListener(MouseEvent.DOUBLE_CLICK, placeO);
tile2.addEventListener(MouseEvent.DOUBLE_CLICK, placeO);
...

There is a chance you must swap e.target with e.currentTarget in the handlers as well. I don't have the documentation handy right now.

Another solution is to add MouseChildren = false to the buttons, like: tile1.MouseChildren = false; so only the button itself will trigger the event and not any other children objects (like the text) inside them.

Last edited by djpaul1963; 02-08-2013 at 04:19 PM..
djpaul1963 is offline   Reply With Quote
Users who have thanked djpaul1963 for this post:
Nookie (02-13-2013)