“的glassPane'的AS3拦截事件,一切都在舞台上? [英] 'glasspane' for as3 to intercept events to everything on stage?

查看:212
本文介绍了“的glassPane'的AS3拦截事件,一切都在舞台上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么样的AS3在java的glassPane?

当你想能够赶上事件或画在已经包含一个或多个组件面积的玻璃面板是非常有用的。例如,可以通过使玻璃板截距事件停用鼠标事件的多组分区域。或者你也可以显示图像上使用玻璃面板多个组件。的的 http://java.sun.com/docs/books/tutorial/uiswing/components/rootpane.html

为什么这样做?虽然一些动画正在进行闪光灯,我想prevent任何mouseevents烧制而成。我可以系统地删除所有监听器,那么动画完成后,再进行添加,但如果有像一个的glassPane,它可能是一个更简单的方法来达到同样的效果。

我目前的想法是:

  1. 添加一个精灵在舞台上
  2. 伸展宽度和舞台的高度,
  3. 给精灵的最高z顺序,
  4. 在抢这个精灵的所有事件,并停止其传播?
解决方案

如果您设置

 启用=假;
mouseChildren =虚假的;
 

上到最高的DisplayObject应该禁用所有鼠标事件为您的应用程序。我用它和它的工作原理治疗。

Is there something like the java 'glasspane' in as3?

The glass pane is useful when you want to be able to catch events or paint over an area that already contains one or more components. For example, you can deactivate mouse events for a multi-component region by having the glass pane intercept the events. Or you can display an image over multiple components using the glass pane. http://java.sun.com/docs/books/tutorial/uiswing/components/rootpane.html

Why do this? While some animations are underway in flash, I want to prevent any mouseevents from firing. I could remove all listeners systematically, then re-add them after the animation, but if there is something like a glasspane, it might be an easier way to achieve the same effect.

My current thinking is to:

  1. add a sprite to the stage
  2. stretch to width and height of the stage,
  3. give the sprite the highest z-order,
  4. grab all events on this sprite, and stop their propagation?

解决方案

if you set

enabled=false;
mouseChildren=false;

on to the top most DisplayObject it should disable all mouse events for your app. I've used it and it works a treat.

这篇关于“的glassPane'的AS3拦截事件,一切都在舞台上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆