'glasspane' for as3 to intercept events to everything on stage?


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

<em>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.</em> <a href="http://java.sun.com/docs/books/tutorial/uiswing/components/rootpane.html" rel="nofollow">http://java.sun.com/docs/books/tutorial/uiswing/components/rootpane.html</a>

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:

<ol><li>add a sprite to the stage</li> <li>stretch to width and height of the stage, </li> <li>give the sprite the highest z-order, </li> <li>grab all events on this sprite, and stop their propagation?</li> </ol>


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.


For a more specific approach, e.g. only block clicks but let mouse down etc. through I use this approach. It uses a 'clickBlocker' stage event handler during capture phase, stopping propagation to any other object.

public function blockClicks():void{ if(!stage) return; stage.addEventListener(MouseEvent.CLICK, clickBlocker, true); //useCapture! } private function clickBlocker(event:MouseEvent):void{ trace("Me (the stage) gets the "+event.type+" first, and I block it @"+event.stageX+"/"+event.stageY); event.stopImmediatePropagation(); }


  • Java: mouse hit detection with overlapping JComponents
  • Anchoring and Docking Controls in java Swing
  • Collision detection (CGRectIntersectRect)
  • Trigger events from Firefox browser extension?
  • Building GUI using GroupLayout in Java
  • Drawing shapes on a JForm java
  • Problem with jquery ajax and google chrome
  • HTML5 embed tag - event attributes not firing (onended, onpause etc)
  • Preventing ctrl+z in browser
  • Gradle DSL Method not found: testCompile()
  • Where can I find a good tutorial to start programming using Cocos2D-x? [closed]
  • tips for installing postgres for a rails project on a linux box
  • How can I make a circular menu icon? Please see details
  • Creating A C# & XNA 'Monster Dash' Like Game
  • Creating a checkmark inside a Pickerview [duplicate]
  • Programmatically change first page jQuery Mobile shows
  • Java Switch Statement Number Varies
  • Upload a Java and node.js project to Google AppEngine at once
  • reading the .fcs files
  • How to bring mp3 file information on jplayer
  • android with msaccess
  • EJB @Schedule issue
  • Error:Execution failed for task ':app:dexDebug'. when importing ParseLoginUI as a module
  • How can I include multiple models in one view for in a Joomla 3.x component built with Component Cre
  • What is the best Linux distro to work with Ruby on Rails? [closed]
  • In a MEAN stack, how can I do one-time MongoDB indexing?
  • Python PIL remove sections of an image based on its colour
  • record audio in HTML / js without Flash?
  • Consuming a web service with the Netbeans Platform
  • Disabling sound of embedded flash object with html
  • Changing media screen makes div overlay
  • Consuming a WCF service in a Java Client using wsHttpBinding
  • Bash if statement with multiple conditions
  • How do I include a SWC in an AS2 Flash project?
  • Tamper-proof configuration files in .NET?
  • Xamarin Forms - UWP Fonts
  • Regex thinks I'm nesting, but I'm not
  • What is the “return” in scheme?
  • WOWZA + RTMP + HTML5 Playback?
  • How to disable jQuery.jplayer autoplay?