/* ------------------------------------------------------ Fader Component, v2.1 ------------------------------------------------------ updated august 21 2002 Martijn de Visser www.flashcomponents.net ------------------------------------------------------ Public methods: enable() enables the component disable() disables the component isEnabled() returns state of component */ import mx.core.UIObject; import com.cetdemi.RoundedRectangle; import mx.skins.RectBorder; import mx.core.ext.UIObjectExtensions; class com.cetdemi.Effects.AbstractHitListener extends UIObject { private var mcDeadPreview:MovieClip; private var targetInstance; private var _respectShape:Boolean; private var __targetInstanceName; private var mouseOutside:Boolean; private var clipParameters:Object = {respectShape:1,_targetInstanceName:1}; function AbstractHitListener() { } function init() { if (this._targetInstanceName.length > 0) { this.targetInstance = this._parent[this._targetInstanceName]; if (this.targetInstance instanceof MovieClip) { this._visible = false; this.mouseOutside = !this.targetInstance.hitTest(_root._xmouse,_root._ymouse, this.respectShape) this.enabled = true; } else { this.enabled = false; } } onMouseMove = onIdle; } function onEnterFrame() { onIdle(); } function onIdle() { if (this.enabled) { if(this.targetInstance.hitTest(_root._xmouse,_root._ymouse, this.respectShape)) { // mouse comes within target clip area if (this.mouseOutside) { this.mouseOutside = false; this.mouseEnter(); } } else { // mouse goes out of target clip area if (!this.mouseOutside) { this.mouseOutside = true; this.mouseLeave(); } } } } //Must be overwritten by children function mouseEnter() { } function mouseLeave() { } [Inspectable(defaultValue="")] function set _targetInstanceName(newop:String) { __targetInstanceName = newop; invalidate(); } function get _targetInstanceName() { return __targetInstanceName; } [Inspectable(defaultValue=false, type="Boolean")] function set respectShape(newop:Boolean) { _respectShape = newop; invalidate(); } function get respectShape() { return _respectShape; } }