// Decompiled by AS3 Sorcerer 6.78
// www.buraks.com/as3sorcerer

//forms.checkboxed.GreenCheckBox

package forms.checkboxed
{
    import flash.display.Sprite;
    import flash.display.BitmapData;
    import flash.display.Bitmap;
    import flash.events.MouseEvent;
    import flash.events.Event;

    public class GreenCheckBox extends Sprite 
    {

        private static const normalStateClass:Class = GreenCheckBox_normalStateClass;
        private static const normalStateBitmapData:BitmapData = Bitmap(new normalStateClass()).bitmapData;
        private static const overStateClass:Class = GreenCheckBox_overStateClass;
        private static const overStateBitmapData:BitmapData = Bitmap(new overStateClass()).bitmapData;
        private static const pressedStateClass:Class = GreenCheckBox_pressedStateClass;
        private static const pressedStateBitmapData:BitmapData = Bitmap(new pressedStateClass()).bitmapData;
        public static const BUTTON_WIDTH:int = 30;
        private static const ICON_X:int = 6;
        private static const ICON_Y:int = 7;

        private var _isPressed:Boolean;
        private var icon:Bitmap;
        private var buttonNormalState:Bitmap;
        private var buttonOverState:Bitmap;
        private var buttonPressedState:Bitmap;

        public function GreenCheckBox()
        {
            this.buttonPressedState = new Bitmap(pressedStateBitmapData);
            addChild(this.buttonPressedState);
            this.buttonNormalState = new Bitmap(normalStateBitmapData);
            addChild(this.buttonNormalState);
            this.buttonOverState = new Bitmap(overStateBitmapData);
            addChild(this.buttonOverState);
            addEventListener(MouseEvent.CLICK, this.onClick);
            this.isPressed = false;
            mouseChildren = true;
            mouseEnabled = true;
            buttonMode = true;
            useHandCursor = true;
        }

        private function onClick(param1:MouseEvent):void
        {
            this.isPressed = (!(this._isPressed));
            dispatchEvent(new Event(Event.CHANGE));
        }

        public function destroy():void
        {
            removeEventListener(MouseEvent.CLICK, this.onClick);
            if ((!(this._isPressed)))
            {
                removeEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver);
                removeEventListener(MouseEvent.MOUSE_OUT, this.onMouseOut);
            };
        }

        public function set isPressed(param1:Boolean):void
        {
            this._isPressed = param1;
            if (this._isPressed)
            {
                removeEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver);
                removeEventListener(MouseEvent.MOUSE_OUT, this.onMouseOut);
                this.setState(3);
            }
            else
            {
                this.setState(1);
                addEventListener(MouseEvent.MOUSE_OVER, this.onMouseOver);
                addEventListener(MouseEvent.MOUSE_OUT, this.onMouseOut);
            };
        }

        private function setState(param1:int):void
        {
            switch (param1)
            {
                case 1:
                    this.buttonNormalState.visible = true;
                    this.buttonOverState.visible = false;
                    this.buttonPressedState.visible = false;
                    break;
                case 2:
                    this.buttonOverState.visible = true;
                    break;
                case 3:
                    this.buttonNormalState.visible = false;
                    this.buttonOverState.visible = false;
                    this.buttonPressedState.visible = true;
            };
        }

        private function onMouseOver(param1:MouseEvent):void
        {
            this.setState(2);
        }

        private function onMouseOut(param1:MouseEvent):void
        {
            this.setState(1);
        }

        override public function get width():Number
        {
            return (BUTTON_WIDTH);
        }


    }
}//package forms.checkboxed
как сделать чтобы кнопка нажималась и центру, а не только по бокам