/** * com.sekati.demo.FilterBtn * @version 1.0.1 * @author jason m horwitz | sekati.com * Copyright (C) 2007 jason m horwitz, Sekat LLC. All Rights Reserved. * Released under the MIT License: http://www.opensource.org/licenses/mit-license.php */ import com.sekati.display.CoreClip; import com.sekati.log.Out; import com.sekati.utils.Delegate; /** * FilterBtn demo for {@link com.sekati.log.Out} and {@link com.sekati.log.OutPanel} */ class com.project.ui.FilterBtn extends CoreClip { private var _tf:TextField; private var _out:Out; private var _self:String; private var _isFiltered:Boolean; // constructor private function FilterBtn() { } private function configUI():Void { _tf = _this.tf; _out = Out.getInstance( ); _self = _this._name; _isFiltered = false; setText( ); _out.trace( _this, "filterBtn initialized ..." ); _this.onRollOver = Delegate.create( _this, btn_onRollOver ); _this.onRollOut = Delegate.create( _this, btn_onRollOut ); _this.onPress = Delegate.create( _this, btn_onPress ); _this.onRelease = Delegate.create( _this, btn_onRelease ); _this.onReleaseOutside = Delegate.create( _this, btn_onRelease ); } private function btn_onRollOver():Void { _out.info( _this, _self + ".onRollOver()" ); } private function btn_onRollOut():Void { _out.info( _this, _self + ".onRollOut()" ); } private function btn_onPress():Void { _out.info( _this, _self + ".onPress()" ); toggleFilter( ); setText( ); _out.status( _this, _self + "._isFiltered = " + _isFiltered ); } private function btn_onRelease():Void { _out.info( _this, _self + ".onRelease()" ); } private function toggleFilter():Void { _isFiltered = (_isFiltered) ? false : true; _out.setFilter( _this, _isFiltered ); } private function setText():Void { _tf.text = _self; _tf.text += (_isFiltered) ? " (filtered)" : " (unfiltered)"; } }