View Full Version : Hiding from mouse events?
Brent Summers
February 2nd, 2009, 05:55 PM
I am building an interactive map and have run into a very interesting problem.
After adding a floating cloud layer on top of the map all the elements below the cloud layer are inaccessible as the cloud layer is the only object getting mouse events.
Is there a way to to tell flash to ignore the cloud layer for purposes of interaction?
BeerOclock
February 2nd, 2009, 06:57 PM
cloud.mouseEnabled = false;
If you havnt looked at this yet, check it out:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/index.html
Its the Actionscript 3 language reference.
Once you're used to it, you can usually answer your own questions faster than someone else will reply on some forum.
ayumilove
February 2nd, 2009, 07:07 PM
Create 2 movieclips on stage, 1 is cloud, the other is a button/object which is listening to clicks
//AddEventListeners for myCloud and myButton MovieClips for testing
myCloud.addEventListener(MouseEvent.MOUSE_DOWN,clo udHandler);
myButton.addEventListener(MouseEvent.MOUSE_UP,clic kHandler);
function clickHandler(e:MouseEvent)
{
myCloud.visible = true;
trace(e.currentTarget.name); //traces button instance name
trace("Hello Ayumilove!");
}
function cloudHandler(e:MouseEvent)
{
myCloud.visible = false;
}
myCloud.mouseEnabled =false;
myButton.addEventListener(MouseEvent.CLICK,clickHa ndler);
function clickHandler(e:MouseEvent)
{
trace(e.currentTarget.name); //traces button instance name
trace("Hello Ayumilove!");
}
unhitched
February 3rd, 2009, 07:05 AM
I had a similar issue recently where I was implementing the swfMacMousewheel from (http://blog.pixelbreaker.com/) in Flex and my TextArea was receiving the MouseEvents instead of the container holding it. As I wanted to leave the text within the TA selectable, MouseEnabled=false was not an option.
In the end I captured the event and redispatched it by attaching a listener to the event and asking the container to dispatch it - "this.dispatchEvent(event)"
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.