views:

40

answers:

2

Hello,

As an AS3 beginner, I'm trying to translate an old AS2 trick into AS3. I want to disable then re-enable any kind of interactivity with all the display objects on the stage, at once. For example while waiting for external assets to load or after a user clicks on a menu item.

This what I used to do with AS2 :

protect_mc.onRelease = function():Void  {};
protect_mc.enabled = false;
protect_mc._alpha = 0;
protect_mc._visible = false;

Then switching protect_mc._visible to true or false.
(protect_mc being an empty movie clip with the stage's height and width, at the highest depth)

My first idea is registering a listener with the Stage for the capture phase of MouseEvent.CLICK that stops all input events propagation (mouse, focus, text...), when a "lock" static variable is set to true or does nothing otherwise.

Second idea is using a Custom Event...

Any advice would be greatly appreciated :)
Thanks.

+1  A: 

The following code disables all interaction with display object and it's children:

movieClip1.mouseChildren = false;
movieClip1.mouseEnabled = false;
Maxim Kachurovskiy
jeremiemv
A: 

if you don't have any listeners attached directly to stage you can also use:

stage.mouseChildren = false;
dx0ne