troubleshooting Question

flex mouse event

Avatar of yarekGmail
yarekGmail asked on
Adobe FlashApache Flex
5 Comments1 Solution389 ViewsLast Modified:
hello experts,

Here is a very simple Flex code.
 
 
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:Script>
	<![CDATA[
		import mx.controls.Alert;
		private function init():void {
			red.addEventListener(MouseEvent.CLICK , clicked);
			green.addEventListener(MouseEvent.CLICK , clicked);
			blue.addEventListener(MouseEvent.CLICK , clicked);
			
		}
		private function clicked(e:MouseEvent):void {
			Alert.show(e.currentTarget.name+" clicked");
		}
		
	]]>
</mx:Script>
		<mx:Canvas x="31" y="46" width="200" height="200" backgroundColor="#FF0000" id="red"  />
		<mx:Canvas x="31" y="46" width="200" height="200" backgroundColor="#00FF00"  id="green" />
		<mx:Canvas x="31" y="46" width="200" height="200" backgroundColor="#0000FF"  id="blue" />
	
</mx:Application>


What I try to achieve is to make red or green clickable.
It is important not to change the layout (no nesting canvas).
I can do it if I make blue visible = false, but I need to keep all layers visible !
It doesn't work if you remove the listener from blue neither.

So how to make the others layers answer the events ?

regards
ASKER CERTIFIED SOLUTION
mausamviki4all

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros