开发者

Disabling/re-enabling interactivity

开发者 https://www.devze.com 2023-01-04 11:40 出处:网络
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

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 us开发者_StackOverflowed 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.


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

movieClip1.mouseChildren = false;
movieClip1.mouseEnabled = false;


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

stage.mouseChildren = false;
0

精彩评论

暂无评论...
验证码 换一张
取 消