Antyvirek
Antyvirek

Reputation: 85

Is it possible to make an object "Transparent" to mouse click?

Im developing a flash game, and i would love to implement raining effect. Here's my progress on rain so far: http://www.squ4re.eu/Rain.html

The code is pretty simple; every raindrop is an object, when it hits the ground it places itself again at the top of the screen and adds splash animation.

But the problem is to click something BEHIND the rain. Lets say i have some selectable units at the battleground. In most cases an random raindrop interrupts selecting an object behind it. So here's my question: Is it possible in flash to create object "transparent" to mouse click, so i can click an object behind it? Or is there any other way to solve this problem?

Thank you in advance.

Upvotes: 0

Views: 1080

Answers (1)

Nicolas Siver
Nicolas Siver

Reputation: 2885

As @putvande mentioned, you could use mouseEnabled on every interactive object that should be disabled for mouse interaction. You also could create rainLayer and disable it for mouse interaction:

myRainLayer.mouseEnabled = false;
myRainLayer.mouseChildren = false;

mouseChildren - determines whether or not the children of the object are mouse, or user input device, enabled. If an object is enabled, a user can interact with it by using a mouse or user input device. The default is true.

Also consider to use display objects that don't inherit from InteractiveObject, like Bitmap, Shape and Video

Upvotes: 2

Related Questions