topical media & game development
actionscript-eventflow-stoppropagation-ToolPanel.ax
actionscript-eventflow-stoppropagation-ToolPanel.ax
[swf]
flex
package {
import flash.display.Sprite;
import flash.events.*;
public class @ax-actionscript-eventflow-stoppropagation-ToolPanel extends Sprite {
private var enabled:Boolean;
public function @ax-actionscript-eventflow-stoppropagation-ToolPanel () {
enabled = false;
var tool1:actionscript_eventflow_stoppropagation_Tool = new actionscript_eventflow_stoppropagation_Tool();
var tool2:actionscript_eventflow_stoppropagation_Tool = new actionscript_eventflow_stoppropagation_Tool();
var tool3:actionscript_eventflow_stoppropagation_Tool = new actionscript_eventflow_stoppropagation_Tool();
tool2.x = tool1.width + 10;
tool3.x = tool2.x + tool2.width + 10;
addChild(tool1);
addChild(tool2);
addChild(tool3);
// Register with this object for MouseEvent.CLICK event notification
// during the capture phase
addEventListener(MouseEvent.CLICK, clickListener, true);
}
private function clickListener (e:MouseEvent):void {
// If this @ax-actionscript-eventflow-stoppropagation-ToolPanel object is disabled...
if (!enabled) {
// ...then stop this click event from reaching this @ax-actionscript-eventflow-stoppropagation-ToolPanel
// object's descendants
e.stopPropagation();
trace("Panel disabled. Click event dispatch halted.");
}
}
}
}
(C) Æliens
27/08/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.