In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Minimal Designer

MinimalComps UI Editor, adapted to WFL!
ref. http://www.bit-101.com/blog/?p=2332
Get Adobe Flash player
by FLASHMAFIA 07 Apr 2014
/**
 * Copyright FLASHMAFIA ( http://wonderfl.net/user/FLASHMAFIA )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/jNAZ
 */

package {
    import com.bit101.components.Label;

    import flash.display.Sprite;
    import flash.events.Event;
    import flash.system.System;

    [SWF(width = '465', height = '465')]
    public class MinimalDesigner extends Sprite {
        private var _componentStage : ComponentStage;
        private var _componentPanel : ComponentPanel;
        private var _projectPanel : ProjectPanel;
        private var _propertiesPanel : PropertiesPanel;

        function MinimalDesigner() {
            if (stage) onStage(null);
            else addEventListener(Event.ADDED_TO_STAGE, onStage, false, 0, true);
        }

        private function onStage(e : Event) : void {
            if (e) removeEventListener(e.type, onStage);

            stage.scaleMode = 'noScale';
            stage.align = 'TL';
            stage.quality = 'low';
            stage.frameRate = 24;
            stage.stageFocusRect = tabChildren = tabEnabled = mouseEnabled = false;
            opaqueBackground = stage.color = 0xEEEEEE;

            _componentPanel = new ComponentPanel(this, 0, 0);
            _componentPanel.addEventListener('newComp', onNewComp);

            _componentStage = new ComponentStage(stage.stageWidth, stage.stageHeight);
            _componentStage.x = _componentPanel.width;
            _componentStage.y = 0;
            _componentStage.addEventListener(Event.SELECT, onComponentSelect);

            addChildAt(_componentStage, 0);

            _projectPanel = new ProjectPanel(this, stage.stageWidth - 140, 10);
            _projectPanel.addEventListener(Event.CHANGE, onSettingsChange);
            _projectPanel.addEventListener('delete', onDelete);
            _projectPanel.addEventListener(Event.RESIZE, onComponentStageResize);
            _projectPanel.addEventListener('generateCode', onGenerateCode);

            _propertiesPanel = new PropertiesPanel(this, 0, 0);

            new Label(this, _componentPanel.width + 5, 0, 'WFL V.0.1');

            _componentStage.x = int(((((stage.stageWidth - _componentPanel.width) - _componentStage.width) / 2) + _componentPanel.width));
            _componentStage.y = int((((stage.stageHeight - _propertiesPanel.height) - _componentStage.height) / 2));

            stage.addEventListener(Event.RESIZE, onStageResize);
            onStageResize(null);
        }

        private function onStageResize(e : Event) : void {
            _componentPanel.height = stage.stageHeight;

            _propertiesPanel.x = _componentPanel.width;
            _propertiesPanel.y = (stage.stageHeight - _propertiesPanel.height);
            _propertiesPanel.width = (stage.stageWidth - _componentPanel.width);
        }

        private function onSettingsChange(e : Event) : void {
            _componentStage.gridSize = _projectPanel.gridSize;
            _componentStage.snapToGrid = _projectPanel.snapToGrid;
            _componentStage.showGrid = _projectPanel.showGrid;
        }

        private function onComponentStageResize(e : Event) : void {
            _componentStage.width = _projectPanel.stageWidth;
            _componentStage.height = _projectPanel.stageHeight;
        }

        private function onNewComp(e : Event) : void {
            _componentStage.addComponent(new ComponentWrapper(_componentPanel.selectedClass));
        }

        private function onGenerateCode(e : Event) : void {
            System.setClipboard((new CodeGenerator(_componentStage, _projectPanel.className)).generateCode(_projectPanel.localVars));
        }

        private function onComponentSelect(e : Event) : void {
            _propertiesPanel.component = _componentStage.selectedComponent;
        }

        private function onDelete(e : Event) : void {
            _componentStage.deleteSelected();
        }
    }
}

import com.bit101.components.CheckBox;
import com.bit101.components.ColorChooser;
import com.bit101.components.Component;
import com.bit101.components.HSlider;
import com.bit101.components.HUISlider;
import com.bit101.components.InputText;
import com.bit101.components.Label;
import com.bit101.components.ProgressBar;
import com.bit101.components.PushButton;
import com.bit101.components.RadioButton;
import com.bit101.components.Text;
import com.bit101.components.VBox;
import com.bit101.components.VSlider;
import com.bit101.components.VUISlider;
import com.bit101.components.Window;

import flash.display.DisplayObjectContainer;
import flash.display.Shape;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.utils.getDefinitionByName;
import flash.utils.getQualifiedClassName;


internal class ComponentStrategy {
    protected var _componentWrapper : ComponentWrapper;

    internal static function strategyForClassName(type : String) : ComponentStrategy {
        if (type == 'CheckBox') return new CheckBoxStrategy();
        else if (type == 'ColorChooser') return new ColorChooserStrategy();
        else if (type == 'HSlider') return new HSliderStrategy();
        else if (type == 'HUISlider') return new HUISliderStrategy();
        else if (type == 'InputText') return new InputTextStrategy();
        else if (type == 'Label') return new LabelStrategy();
        else if (type == 'ProgressBar') return new ProgressBarStrategy();
        else if (type == 'PushButton') return new PushButtonStrategy();
        else if (type == 'RadioButton') return new RadioButtonStrategy();
        else if (type == 'Text') return new TextStrategy();
        else if (type == 'VSlider') return new VSliderStrategy();
        else if (type == 'VUISlider') return new VUISliderStrategy();
        else return new ComponentStrategy();
    }

    internal function set componentWrapper(componentWrapper : ComponentWrapper) : void {
        _componentWrapper = componentWrapper;
    }

    internal function get componentWrapper() : ComponentWrapper {
        return _componentWrapper;
    }

    internal function updateColumn2(prop2 : PropertyColumn2) : void {
        prop2.handlerLabel.visible = false;
        prop2.handlerText.visible = false;
        prop2.labelLabel.visible = false;
        prop2.labelText.visible = false;
        prop2.toggleCB.visible = false;
        prop2.selectedCB.visible = false;
        prop2.colorLabel.visible = false;
        prop2.colorChooser.visible = false;
    }

    internal function updateFromColumn2Values(prop2 : PropertyColumn2) : void {
    }

    internal function updateColumn3(prop3 : PropertyColumn3) : void {
        prop3.maxLabel.visible = false;
        prop3.maxText.visible = false;
        prop3.minLabel.visible = false;
        prop3.minText.visible = false;
        prop3.valueLabel.visible = false;
        prop3.valueText.visible = false;
        prop3.tickLabel.visible = false;
        prop3.tickText.visible = false;
        prop3.precisionLabel.visible = false;
        prop3.precisionText.visible = false;
    }

    internal function updateFromColumn3Values(prop3 : PropertyColumn3) : void {
    }

    internal function updateColumn4(prop4 : PropertyColumn4) : void {
        prop4.restrictLabel.visible = false;
        prop4.restrictText.visible = false;
        prop4.maxCharsLabel.visible = false;
        prop4.maxCharsText.visible = false;
        prop4.passwordCB.visible = false;
        prop4.autosizeCB.visible = false;
        prop4.editableCB.visible = false;
    }

    internal function updateFromColumn4Values(prop4 : PropertyColumn4) : void {
    }

    internal function generateCode(par0 : String, par1 : String, par2 : Number, par3 : Number, flag : int = 1) : String {
        par0;
        par1;
        par2;
        par3;
        flag;

        return ('');
    }
}

internal class ComponentWrapper extends Sprite {
    private var _component : Component;
    private var _componentClass : Class;
    private var _overlay : Shape;
    private var _selected : Boolean;
    private var _handler : String = '';
    private var _type : String;
    private var _componentStrategy : ComponentStrategy;

    function ComponentWrapper(componentClass : Class) {
        _componentClass = componentClass;
        _component = new _componentClass(this);
        _type = getQualifiedClassName(_componentClass).split('::')[1];

        name = 'compo_' + _type;

        if (_component.hasOwnProperty('label')) _component['label'] = _type;
        if (_component.hasOwnProperty('text')) _component['text'] = _type;

        _componentStrategy = ComponentStrategy.strategyForClassName(_type);
        _componentStrategy.componentWrapper = this;
        _component.draw();
        _component.addEventListener(Event.RESIZE, onComponentResize);

        useHandCursor = true;
        buttonMode = true;

        addChild(_overlay = new Shape());

        drawOverlay();

        addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
    }

    private function drawOverlay() : void {
        _overlay.graphics.clear();

        if (_selected) _overlay.graphics.lineStyle(2, 0xFF, 0.5);

        _overlay.graphics.beginFill(0xFFFFFF, 0);
        _overlay.graphics.drawRect(0, 0, _component.width, _component.height);
        _overlay.graphics.endFill();
    }

    private function onComponentResize(e : Event) : void {
        drawOverlay();
    }

    private function onMouseDown(e : MouseEvent) : void {
        startDrag();

        stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
        stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);

        dispatchEvent(new Event('drag'));
    }

    private function onMouseMove(e : MouseEvent) : void {
        dispatchEvent(new Event(Event.CHANGE));
    }

    private function onMouseUp(e : MouseEvent) : void {
        stopDrag();
        stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
        stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
        dispatchEvent(new Event('drop'));
        dispatchEvent(new Event(Event.CHANGE));
    }

    internal function set selected(value : Boolean) : void {
        _selected = value;

        drawOverlay();
    }

    internal function get selected() : Boolean {
        return (_selected);
    }

    internal function get component() : Component {
        return _component;
    }

    internal function set handler(id : String) : void {
        _handler = id;
    }

    internal function get handler() : String {
        return (_handler);
    }

    internal function get type() : String {
        return (_type);
    }

    internal function updateColumn1(prop1 : PropertyColumn1) : void {
        prop1.nameText.text = name;
        prop1.xText.text = x.toString();
        prop1.yText.text = y.toString();
        prop1.widthText.text = _component.width.toString();
        prop1.heightText.text = _component.height.toString();
    }

    internal function updateFromColumn1Values(prop1 : PropertyColumn1) : void {
        name = prop1.nameText.text;

        x = Number(prop1.xText.text);
        y = Number(prop1.yText.text);

        _component.width = Number(prop1.widthText.text);
        _component.height = Number(prop1.heightText.text);

        drawOverlay();
    }

    internal function updateColumn2(prop2 : PropertyColumn2) : void {
        _componentStrategy.updateColumn2(prop2);
    }

    internal function updateFromColumn2Values(prop2 : PropertyColumn2) : void {
        _componentStrategy.updateFromColumn2Values(prop2);
        drawOverlay();
    }

    internal function updateColumn3(prop3 : PropertyColumn3) : void {
        _componentStrategy.updateColumn3(prop3);
    }

    internal function updateFromColumn3Values(prop3 : PropertyColumn3) : void {
        _componentStrategy.updateFromColumn3Values(prop3);
    }

    internal function updateColumn4(prop4 : PropertyColumn4) : void {
        _componentStrategy.updateColumn4(prop4);
    }

    internal function updateFromColumn4Values(prop4 : PropertyColumn4) : void {
        _componentStrategy.updateFromColumn4Values(prop4);
    }

    internal function generateCode(flag : int = 1) : String {
        return (_componentStrategy.generateCode(name, _type, x, y, flag));
    }
}

internal class ComponentPanel extends Window {
    private var _selectedClass : Class;

    function ComponentPanel(parent : DisplayObjectContainer = null, xpos : Number = 0, ypos : Number = 0) {
        super(parent, xpos, ypos, 'Components');

        width = 120;
        height = 100;

        draggable = false;

        var classNames : Vector.<String> = Vector.<String>(['CheckBox', 'ColorChooser', 'HSlider', 'HUISlider', 'InputText', 'Label', 'ProgressBar', 'PushButton', 'RadioButton', 'Text', 'VSlider', 'VUISlider']);
        var vbox : VBox = new VBox(content, 10, 10);

        vbox.spacing = 2;

        for each (var className : String in classNames) {
            new PushButton(vbox, 0, 0, className, onNewComp);
        }
    }

    private function onNewComp(e : MouseEvent) : void {
        _selectedClass = getDefinitionByName('com.bit101.components.' + e.target.label) as Class;

        dispatchEvent(new Event('newComp'));
    }

    internal function get selectedClass() : Class {
        return _selectedClass;
    }
}

internal class ComponentStage extends Sprite {
    private var _gridSize : Number = 10;
    private var _showGrid : Boolean = true;
    private var _snapToGrid : Boolean = true;
    private var _selectedComponent : ComponentWrapper;
    private var _width : Number;
    private var _height : Number;

    function ComponentStage(w : int, h : int) {
        _width = w;
        _height = h;

        addEventListener(Event.ADDED_TO_STAGE, onStage);
    }

    private function onStage(e : Event) : void {
        draw();

        stage.addEventListener(MouseEvent.CLICK, onStageClick);
        stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
    }

    private function draw() : void {
        graphics.clear();
        graphics.beginFill(0xEEEEEE);
        graphics.drawRect(0, 0, _width, _height);
        graphics.endFill();

        if ((_showGrid) && (_gridSize > 1)) {
            graphics.lineStyle(0, 0, 0.1);

            var i : Number = 0;

            while (i < _width) {
                graphics.moveTo(i, 0);
                graphics.lineTo(i, _height);

                i += _gridSize;
            }

            var j : Number = 0;

            while (j < _height) {
                graphics.moveTo(0, j);
                graphics.lineTo(_width, j);

                j += _gridSize;
            }
        }

        graphics.lineStyle(0, 0x999999, 1);
        graphics.drawRect(0, 0, _width, _height);
    }

    internal function addComponent(componentWrapper : ComponentWrapper) : void {
        componentWrapper.x = int(((_width - componentWrapper.width) / 2));
        componentWrapper.y = int(((_height - componentWrapper.height) / 2));

        componentWrapper.addEventListener('drag', onComponentDrag, false, 0, true);
        componentWrapper.addEventListener('drop', onComponentDrop, false, 0, true);

        addChild(componentWrapper);

        snap(componentWrapper);
    }

    private function onComponentDrag(e : Event) : void {
        setSelected(e.target as ComponentWrapper);
    }

    private function onComponentDrop(e : Event) : void {
        snap(e.target as ComponentWrapper);
    }

    private function onStageClick(e : MouseEvent) : void {
        if ((e.target == stage) || (e.target == this)) setSelected(null);
    }

    private function onMouseDown(e : MouseEvent) : void {
        if (e.target == this) {
            startDrag();
            stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
        }
    }

    private function onMouseUp(e : MouseEvent) : void {
        stopDrag();

        x = int(x);
        y = int(y);

        stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
    }

    private function setSelected(componentWrapper : ComponentWrapper) : void {
        if (_selectedComponent) _selectedComponent.selected = false;

        _selectedComponent = componentWrapper;

        if (_selectedComponent) _selectedComponent.selected = true;

        dispatchEvent(new Event(Event.SELECT));
    }

    private function snap(componentWrapper : ComponentWrapper) : void {
        if (_snapToGrid) {
            componentWrapper.x = int((componentWrapper.x / _gridSize)) * _gridSize;
            componentWrapper.y = int((componentWrapper.y / _gridSize)) * _gridSize;
        } else {
            componentWrapper.x = int(componentWrapper.x);
            componentWrapper.y = int(componentWrapper.y);
        }
    }

    internal function deleteSelected() : void {
        if (!_selectedComponent) return;

        _selectedComponent.removeEventListener('drag', onComponentDrag);
        _selectedComponent.removeEventListener('drop', onComponentDrop);

        removeChild(_selectedComponent);

        setSelected(null);
    }

    internal function set gridSize(value : Number) : void {
        _gridSize = value;
        draw();
    }

    internal function get gridSize() : Number {
        return _gridSize;
    }

    internal function set showGrid(value : Boolean) : void {
        _showGrid = value;
        draw();
    }

    internal function get showGrid() : Boolean {
        return _showGrid;
    }

    internal function set snapToGrid(value : Boolean) : void {
        _snapToGrid = value;

        draw();
    }

    internal function get snapToGrid() : Boolean {
        return _snapToGrid;
    }

    override public function set width(value : Number) : void {
        _width = value;

        draw();
    }

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

    override public function set height(value : Number) : void {
        _height = value;

        draw();
    }

    override public function get height() : Number {
        return _height;
    }

    internal function get selectedComponent() : ComponentWrapper {
        return _selectedComponent;
    }
}

internal class CodeGenerator {
    private var _componentStage : ComponentStage;
    private var _className : String;

    function CodeGenerator(componentStage : ComponentStage, className : String) {
        _componentStage = componentStage;
        _className = className;
    }

    internal function generateCode(flag : int = 1) : String {
        var out : String = '';

        if (!flag) {
            out = out + 'package\n' + '{\n' + '\timport components.*;\n' + '\timport flash.display.Sprite;\n' + '\timport flash.events.Event;\n\n' + '\t[SWF(backgroundColor=0xeeeeee, width=' + _componentStage.width + ', height=' + _componentStage.height + ')]\n' + '\tpublic class ' + _className + ' extends Sprite\n' + '\t{\n';

            var i : int = 0;

            while (i < _componentStage.numChildren) {
                var compoWrap : ComponentWrapper = _componentStage.getChildAt(i) as ComponentWrapper;

                out += '\t\tprivate var ' + compoWrap.name + ':' + compoWrap.type + ';\n';

                i++;
            }

            out += '\n\t\tpublic function ' + _className + '()\n\t\t{\n';
        }

        i = 0;

        while (i < _componentStage.numChildren) {
            compoWrap = (_componentStage.getChildAt(i) as ComponentWrapper);

            out += compoWrap.generateCode(flag);

            i++;
        }

        if (!flag) {
            out = (out + '\t\t}\n');

            i = 0;

            while (i < _componentStage.numChildren) {
                compoWrap = _componentStage.getChildAt(i) as ComponentWrapper;

                if (compoWrap.handler != '') out += '\n\t\tprotected function ' + compoWrap.handler + '(event:Event):void\n\t\t{\n' + '\t\t\ttrace(\'' + compoWrap.handler + '\');\n' + '\t\t}\n';

                i++;
            }

            out += '\t}\n}\n';
        }

        return (out);
    }
}

internal class ProjectPanel extends Window {
    private var _showGridCB : CheckBox;
    private var _snapToGridCB : CheckBox;
    private var _gridSizeText : InputText;
    private var _constructorsRB : RadioButton;
    private var _fullClassRB : RadioButton;
    private var _widthText : InputText;
    private var _heightText : InputText;
    private var _classNameText : InputText;

    function ProjectPanel(parent : DisplayObjectContainer = null, xpos : Number = 0, ypos : Number = 0) {
        super(parent, xpos, ypos, 'Project');

        setSize(130, 270);

        hasMinimizeButton = true;

        new Label(content, 10, 5, 'Width:');

        _widthText = new InputText(content, 60, 5, '600', onSizeChange);
        _widthText.width = 50;
        _widthText.restrict = '0123456789';

        new Label(content, 10, 25, 'Height:');

        _heightText = new InputText(content, 60, 25, '400', onSizeChange);
        _heightText.width = 50;
        _heightText.restrict = '0123456789';

        _showGridCB = new CheckBox(content, 10, 50, 'Show Grid', onSettingsChange);
        _showGridCB.selected = true;
        _snapToGridCB = new CheckBox(content, 10, 70, 'Snap to Grid', onSettingsChange);
        _snapToGridCB.selected = true;

        new Label(content, 10, 90, 'Grid Size:');

        _gridSizeText = new InputText(content, 60, 90, '10', onSettingsChange);
        _gridSizeText.restrict = '0123456789';
        _gridSizeText.width = 50;

        var pushButton : PushButton = new PushButton(content, 10, 115, 'Delete Selected', onDelete);
        pushButton.width = 110;

        _constructorsRB = new RadioButton(content, 10, 150, 'Generate Constructors');
        _constructorsRB.selected = true;

        _fullClassRB = new RadioButton(content, 10, 165, 'Generate Full Class');

        new Label(content, 10, 180, 'Class Name:');

        _classNameText = new InputText(content, 10, 195, 'MiniUI');
        _classNameText.width = 110;

        pushButton = new PushButton(content, 10, 220, 'Copy Code to Clipboard', onGenerateCode);
        pushButton.width = 110;
    }

    private function onSettingsChange(e : Event) : void {
        dispatchEvent(new Event(Event.CHANGE));
    }

    private function onSizeChange(e : Event) : void {
        dispatchEvent(new Event(Event.RESIZE));
    }

    private function onGenerateCode(e : Event) : void {
        dispatchEvent(new Event('generateCode'));
    }

    private function onDelete(e : Event) : void {
        dispatchEvent(new Event('delete'));
    }

    internal function get showGrid() : Boolean {
        return (_showGridCB.selected);
    }

    internal function get snapToGrid() : Boolean {
        return (_snapToGridCB.selected);
    }

    internal function get gridSize() : Number {
        return (Number(_gridSizeText.text));
    }

    internal function get localVars() : int {
        if (_constructorsRB.selected) return 1;
        else return 0;
    }

    internal function get stageWidth() : Number {
        return (Number(_widthText.text));
    }

    internal function get stageHeight() : Number {
        return (Number(_heightText.text));
    }

    internal function get className() : String {
        return (_classNameText.text);
    }
}

internal class PropertiesPanel extends Window {
    private var _component : ComponentWrapper;
    private var _col1 : PropertyColumn1;
    private var _col2 : PropertyColumn2;
    private var _col3 : PropertyColumn3;
    private var _col4 : PropertyColumn4;

    function PropertiesPanel(parent : DisplayObjectContainer = null, xpos : Number = 0, ypos : Number = 0) {
        super(parent, xpos, ypos, 'Properties');

        height = 150;

        content.addChild(_col1 = new PropertyColumn1());
        _col1.x = 10;
        _col1.y = 10;

        content.addChild(_col2 = new PropertyColumn2());
        _col2.x = 180;
        _col2.y = 10;

        content.addChild(_col3 = new PropertyColumn3());
        _col3.x = 360;
        _col3.y = 10;

        content.addChild(_col4 = new PropertyColumn4());
        _col4.x = 540;
        _col4.y = 10;
    }

    internal function set component(componentWrapper : ComponentWrapper) : void {
        _component = componentWrapper;

        if (_component == null) title = 'Properties';
        else title = ('Properties: ' + _component.type);

        _col1.component = _component;
        _col2.component = _component;
        _col3.component = _component;
        _col4.component = _component;
    }

    internal function get component() : ComponentWrapper {
        return _component;
    }
}

internal class PropertyColumn1 extends Sprite {
    internal var nameLabel : Label;
    internal var nameText : InputText;
    internal var xLabel : Label;
    internal var xText : InputText;
    internal var yLabel : Label;
    internal var yText : InputText;
    internal var widthLabel : Label;
    internal var widthText : InputText;
    internal var heightLabel : Label;
    internal var heightText : InputText;
    private var _component : ComponentWrapper;

    function PropertyColumn1() {
        nameLabel = new Label(this, 0, 0, 'Name:');
        nameText = new InputText(this, 50, 0, '', onChange);

        xLabel = new Label(this, 0, 20, 'X pos:');
        xText = new InputText(this, 50, 20, '', onChange);
        xText.restrict = '0123456789.';

        yLabel = new Label(this, 0, 40, 'Y pos:');
        yText = new InputText(this, 50, 40, '', onChange);
        yText.restrict = '0123456789.';

        widthLabel = new Label(this, 0, 60, 'Width:');
        widthText = new InputText(this, 50, 60, '', onChange);
        widthText.restrict = '0123456789.';

        heightLabel = new Label(this, 0, 80, 'Height:');
        heightText = new InputText(this, 50, 80, '', onChange);
        heightText.restrict = '0123456789.';
    }

    internal function set component(componentWrapper : ComponentWrapper) : void {
        if (_component) _component.removeEventListener(Event.CHANGE, onComponentChange);

        _component = componentWrapper;

        if (_component) _component.addEventListener(Event.CHANGE, onComponentChange);

        updateFields();
    }

    private function onComponentChange(e : Event) : void {
        updateFields();
    }

    private function updateFields() : void {
        if (_component == null) {
            visible = false;
        } else {
            visible = true;
            _component.updateColumn1(this);
        }
    }

    private function onChange(e : Event) : void {
        _component.updateFromColumn1Values(this);
    }
}

internal class PropertyColumn2 extends Sprite {
    internal var handlerLabel : Label;
    internal var handlerText : InputText;
    internal var labelLabel : Label;
    internal var labelText : InputText;
    internal var toggleCB : CheckBox;
    internal var selectedCB : CheckBox;
    internal var colorLabel : Label;
    internal var colorChooser : ColorChooser;
    private var _component : ComponentWrapper;

    function PropertyColumn2() {
        handlerLabel = new Label(this, 0, 0, 'Handler:');
        handlerText = new InputText(this, 50, 0, '', onPropertyChange);
        labelLabel = new Label(this, 0, 20, 'Label:');
        labelText = new InputText(this, 50, 20, '', onPropertyChange);
        toggleCB = new CheckBox(this, 0, 45, 'Toggle', onPropertyChange);
        selectedCB = new CheckBox(this, 0, 65, 'Selected', onPropertyChange);
        colorLabel = new Label(this, 0, 80, 'Color:');
        colorChooser = new ColorChooser(this, 50, 80, 0xFF0000, onPropertyChange);

        updateFields();
    }

    internal function set component(componentWrapper : ComponentWrapper) : void {
        _component = componentWrapper;
        updateFields();
    }

    private function onPropertyChange(e : Event) : void {
        _component.updateFromColumn2Values(this);
    }

    private function updateFields() : void {
        if (_component == null) {
            visible = false;
        } else {
            visible = true;
            _component.updateColumn2(this);
        }
    }
}

internal class PropertyColumn3 extends Sprite {
    internal var maxLabel : Label;
    internal var maxText : InputText;
    internal var minLabel : Label;
    internal var minText : InputText;
    internal var valueLabel : Label;
    internal var valueText : InputText;
    internal var tickLabel : Label;
    internal var tickText : InputText;
    internal var precisionLabel : Label;
    internal var precisionText : InputText;
    private var _component : ComponentWrapper;

    function PropertyColumn3() {
        maxLabel = new Label(this, 0, 0, 'Maximum:');
        maxText = new InputText(this, 50, 0, '', onPropertyChange);
        maxText.restrict = '0123456789.';
        minLabel = new Label(this, 0, 20, 'Minimum:');
        minText = new InputText(this, 50, 20, '', onPropertyChange);
        minText.restrict = '0123456789.';
        valueLabel = new Label(this, 0, 40, 'Value:');
        valueText = new InputText(this, 50, 40, '', onPropertyChange);
        valueText.restrict = '0123456789.';
        tickLabel = new Label(this, 0, 60, 'Tick:');
        tickText = new InputText(this, 50, 60, '', onPropertyChange);
        tickText.restrict = '0123456789.';
        precisionLabel = new Label(this, 0, 80, 'Precision:');
        precisionText = new InputText(this, 50, 80, '', onPropertyChange);
        precisionText.restrict = '0123456789';

        updateFields();
    }

    internal function set component(componentWrapper : ComponentWrapper) : void {
        _component = componentWrapper;

        updateFields();
    }

    private function updateFields() : void {
        if (!_component) {
            visible = false;
        } else {
            visible = true;
            _component.updateColumn3(this);
        }
    }

    private function onPropertyChange(e : Event) : void {
        _component.updateFromColumn3Values(this);
    }
}

internal class PropertyColumn4 extends Sprite {
    internal var restrictLabel : Label;
    internal var restrictText : InputText;
    internal var maxCharsLabel : Label;
    internal var maxCharsText : InputText;
    internal var passwordCB : CheckBox;
    internal var autosizeCB : CheckBox;
    internal var editableCB : CheckBox;
    private var _component : ComponentWrapper;

    function PropertyColumn4() {
        restrictLabel = new Label(this, 0, 0, 'Restrict:');
        restrictText = new InputText(this, 50, 0, '', onPropertyChange);

        maxCharsLabel = new Label(this, 0, 20, 'MaxChars:');
        maxCharsText = new InputText(this, 50, 20, '', onPropertyChange);
        maxCharsText.restrict = '0123456789';

        passwordCB = new CheckBox(this, 0, 45, 'Password', onPropertyChange);
        autosizeCB = new CheckBox(this, 0, 65, 'Autosize', onPropertyChange);
        editableCB = new CheckBox(this, 0, 85, 'Editable', onPropertyChange);

        updateFields();
    }

    internal function set component(componentWrapper : ComponentWrapper) : void {
        _component = componentWrapper;

        updateFields();
    }

    private function updateFields() : void {
        if (!_component) {
            visible = false;
        } else {
            visible = true;
            _component.updateColumn4(this);
        }
    }

    private function onPropertyChange(e : Event) : void {
        _component.updateFromColumn4Values(this);
    }
}

internal class CheckBoxStrategy extends ComponentStrategy {
    override internal function updateColumn2(prop2 : PropertyColumn2) : void {
        var compo : CheckBox = CheckBox(_componentWrapper.component);

        prop2.handlerLabel.visible = true;
        prop2.handlerText.visible = true;
        prop2.handlerText.text = _componentWrapper.handler;
        prop2.labelLabel.visible = true;
        prop2.labelLabel.text = 'Label';
        prop2.labelText.visible = true;
        prop2.labelText.text = compo.label;
        prop2.toggleCB.visible = false;
        prop2.selectedCB.visible = true;
        prop2.selectedCB.selected = compo.selected;
        prop2.colorLabel.visible = false;
        prop2.colorChooser.visible = false;
    }

    override internal function updateFromColumn2Values(prop2 : PropertyColumn2) : void {
        _componentWrapper.handler = prop2.handlerText.text;

        var compo : CheckBox = CheckBox(_componentWrapper.component);
        compo.label = prop2.labelText.text;
        compo.selected = prop2.selectedCB.selected;
    }

    override internal function generateCode(par0 : String, par1 : String, par2 : Number, par3 : Number, flag : int = 1) : String {
        var compo : CheckBox = CheckBox(_componentWrapper.component);

        if (flag) var out : String = 'var ' + par0 + ':' + par1 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3 + ', \'' + compo.label + '\'';
        else out = '\t\t\t' + par0 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3 + ', \'' + compo.label + '\'';

        if (_componentWrapper.handler != '') out += ', ' + _componentWrapper.handler;

        out += ');\n';

        if (compo.selected) out += par0 + '.selected = true;\n';

        return out + '\n';
    }
}

internal class ColorChooserStrategy extends ComponentStrategy {
    override internal function updateColumn2(prop2 : PropertyColumn2) : void {
        prop2.handlerLabel.visible = true;
        prop2.handlerText.visible = true;
        prop2.handlerText.text = _componentWrapper.handler;
        prop2.labelLabel.visible = false;
        prop2.labelText.visible = false;
        prop2.toggleCB.visible = false;
        prop2.selectedCB.visible = false;
        prop2.colorLabel.visible = true;
        prop2.colorChooser.visible = true;
        prop2.colorChooser.value = ColorChooser(_componentWrapper.component).value;
    }

    override internal function updateFromColumn2Values(prop2 : PropertyColumn2) : void {
        _componentWrapper.handler = prop2.handlerText.text;
        ColorChooser(_componentWrapper.component).value = prop2.colorChooser.value;
    }

    override internal function generateCode(par0 : String, par1 : String, par2 : Number, par3 : Number, flag : int = 1) : String {
        var colorTxt : String = (ColorChooser(_componentWrapper.component).value).toString(16);

        if (flag) var out : String = 'var ' + par0 + ':' + par1 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3 + ', 0x' + colorTxt;
        else out = '\t\t\t' + par0 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3 + ', 0x' + colorTxt;

        if (_componentWrapper.handler != '') out += ', ' + _componentWrapper.handler;

        out += ');\n\n';

        return (out);
    }
}

internal class HSliderStrategy extends ComponentStrategy {
    override internal function updateColumn2(prop2 : PropertyColumn2) : void {
        prop2.handlerLabel.visible = true;
        prop2.handlerText.visible = true;
        prop2.handlerText.text = _componentWrapper.handler;
        prop2.labelLabel.visible = false;
        prop2.labelText.visible = false;
        prop2.toggleCB.visible = false;
        prop2.selectedCB.visible = false;
        prop2.colorLabel.visible = false;
        prop2.colorChooser.visible = false;
    }

    override internal function updateFromColumn2Values(prop2 : PropertyColumn2) : void {
        _componentWrapper.handler = prop2.handlerText.text;
    }

    override internal function updateColumn3(prop3 : PropertyColumn3) : void {
        var compo : HSlider = HSlider(_componentWrapper.component);

        prop3.maxLabel.visible = true;
        prop3.maxText.visible = true;
        prop3.maxText.text = compo.maximum.toString();
        prop3.minLabel.visible = true;
        prop3.minText.visible = true;
        prop3.minText.text = compo.minimum.toString();
        prop3.valueLabel.visible = true;
        prop3.valueText.visible = true;
        prop3.valueText.text = compo.value.toString();
        prop3.tickLabel.visible = true;
        prop3.tickText.visible = true;
        prop3.tickText.text = compo.tick.toString();
        prop3.precisionLabel.visible = false;
        prop3.precisionText.visible = false;
    }

    override internal function updateFromColumn3Values(prop3 : PropertyColumn3) : void {
        var compo : HSlider = HSlider(_componentWrapper.component);
        compo.maximum = Number(prop3.maxText.text);
        compo.minimum = Number(prop3.minText.text);
        compo.value = Number(prop3.valueText.text);
        compo.tick = Number(prop3.tickText.text);
    }

    override internal function generateCode(par0 : String, par1 : String, par2 : Number, par3 : Number, flag : int = 1) : String {
        var compo : HSlider = HSlider(_componentWrapper.component);

        if (flag) var out : String = 'var ' + par0 + ':' + par1 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3;
        else out = '\t\t\t' + par0 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3;

        if (_componentWrapper.handler != '') out += ', ' + _componentWrapper.handler;

        out += ');\n';

        if (compo.width != 100) out += par0 + '.width = ' + compo.width + ';\n';
        if (compo.maximum != 100) out += par0 + '.maximum = ' + compo.maximum + ';\n';
        if (compo.minimum != 0) out += par0 + '.minimum = ' + compo.minimum + ';\n';
        if (compo.value != 0) out += par0 + '.value = ' + compo.value + ';\n';
        if (compo.tick != 1) out += par0 + '.tick = ' + compo.tick + ';\n';

        return out + '\n';
    }
}

internal class HUISliderStrategy extends ComponentStrategy {
    override internal function updateColumn2(prop2 : PropertyColumn2) : void {
        var compo : HUISlider = HUISlider(_componentWrapper.component);

        prop2.handlerLabel.visible = true;
        prop2.handlerText.visible = true;
        prop2.handlerText.text = _componentWrapper.handler;
        prop2.labelLabel.visible = true;
        prop2.labelLabel.text = 'Label';
        prop2.labelText.visible = true;
        prop2.labelText.text = compo.label;
        prop2.toggleCB.visible = false;
        prop2.selectedCB.visible = false;
        prop2.colorLabel.visible = false;
        prop2.colorChooser.visible = false;
    }

    override internal function updateFromColumn2Values(prop2 : PropertyColumn2) : void {
        _componentWrapper.handler = prop2.handlerText.text;

        HUISlider(_componentWrapper.component).label = prop2.labelText.text;
    }

    override internal function updateColumn3(prop3 : PropertyColumn3) : void {
        var compo : HUISlider = HUISlider(_componentWrapper.component);

        prop3.maxLabel.visible = true;
        prop3.maxText.visible = true;
        prop3.maxText.text = compo.maximum.toString();
        prop3.minLabel.visible = true;
        prop3.minText.visible = true;
        prop3.minText.text = compo.minimum.toString();
        prop3.valueLabel.visible = true;
        prop3.valueText.visible = true;
        prop3.valueText.text = compo.value.toString();
        prop3.tickLabel.visible = true;
        prop3.tickText.visible = true;
        prop3.tickText.text = compo.tick.toString();
        prop3.precisionLabel.visible = true;
        prop3.precisionText.visible = true;
        prop3.precisionText.text = compo.labelPrecision.toString();
    }

    override internal function updateFromColumn3Values(prop3 : PropertyColumn3) : void {
        var compo : HUISlider = HUISlider(_componentWrapper.component);
        compo.maximum = Number(prop3.maxText.text);
        compo.minimum = Number(prop3.minText.text);
        compo.value = Number(prop3.valueText.text);
        compo.tick = Number(prop3.tickText.text);
        compo.labelPrecision = Number(prop3.precisionText.text);
    }

    override internal function generateCode(par0 : String, par1 : String, par2 : Number, par3 : Number, flag : int = 1) : String {
        var compo : HUISlider = HUISlider(_componentWrapper.component);

        if (flag) var out : String = 'var ' + par0 + ':' + par1 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3 + ', \'' + compo.label + '\'';
        else out = '\t\t\t' + par0 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3 + ', \'' + compo.label + '\'';

        if (_componentWrapper.handler != '') out += ', ' + _componentWrapper.handler;

        out += ');\n';

        if (compo.width != 200) out += par0 + '.width = ' + compo.width + ';\n';
        if (compo.maximum != 100) out += par0 + '.maximum = ' + compo.maximum + ';\n';
        if (compo.minimum != 0) out += par0 + '.minimum = ' + compo.minimum + ';\n';
        if (compo.value != 0) out += par0 + '.value = ' + compo.value + ';\n';
        if (compo.tick != 1) out += par0 + '.tick = ' + compo.tick + ';\n';
        if (compo.labelPrecision != 1) out += par0 + '.labelPrecision = ' + compo.labelPrecision + ';\n';

        return out + '\n';
    }
}

internal class InputTextStrategy extends ComponentStrategy {
    override internal function updateColumn2(prop2 : PropertyColumn2) : void {
        var compo : InputText = InputText(_componentWrapper.component);

        prop2.handlerLabel.visible = true;
        prop2.handlerText.visible = true;
        prop2.handlerText.text = _componentWrapper.handler;
        prop2.labelLabel.visible = true;
        prop2.labelLabel.text = 'Text';
        prop2.labelText.visible = true;
        prop2.labelText.text = compo.text;
        prop2.toggleCB.visible = false;
        prop2.selectedCB.visible = false;
        prop2.colorLabel.visible = false;
        prop2.colorChooser.visible = false;
    }

    override internal function updateFromColumn2Values(prop2 : PropertyColumn2) : void {
        _componentWrapper.handler = prop2.handlerText.text;

        InputText(_componentWrapper.component).text = prop2.labelText.text;
    }

    override internal function updateColumn4(prop4 : PropertyColumn4) : void {
        var compo : InputText = InputText(_componentWrapper.component);
        prop4.restrictLabel.visible = true;
        prop4.restrictText.visible = true;

        if (compo.restrict) prop4.restrictText.text = compo.restrict;

        prop4.maxCharsLabel.visible = true;
        prop4.maxCharsText.visible = true;
        prop4.maxCharsText.text = compo.maxChars.toString();
        prop4.passwordCB.visible = true;
        prop4.passwordCB.selected = compo.password;
        prop4.autosizeCB.visible = false;
        prop4.editableCB.visible = false;
    }

    override internal function updateFromColumn4Values(prop4 : PropertyColumn4) : void {
        var compo : InputText = InputText(_componentWrapper.component);
        compo.restrict = prop4.restrictText.text;
        compo.maxChars = Number(prop4.maxCharsText.text);
        compo.password = prop4.passwordCB.selected;
    }

    override internal function generateCode(par0 : String, par1 : String, par2 : Number, par3 : Number, flag : int = 1) : String {
        var compo : InputText = InputText(_componentWrapper.component);

        if (flag) var out : String = 'var ' + par0 + ':' + par1 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3 + ', \'' + compo.text + '\'';
        else out = '\t\t\t' + par0 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3 + ', \'' + compo.text + '\'';

        if (_componentWrapper.handler != '') out += ', ' + _componentWrapper.handler;

        out += ');\n';

        if (compo.width != 100) out += par0 + '.width = ' + compo.width + ';\n';
        if (compo.height != 16) out += par0 + '.height = ' + compo.height + ';\n';
        if ((compo.restrict) && (compo.restrict != '')) out += par0 + '.restrict = \'' + compo.restrict + '\';\n';
        if (compo.maxChars != 0) out += par0 + '.maxChars = ' + compo.maxChars + ';\n';
        if (compo.password) out += par0 + '.password = true;\n';

        return out + '\n';
    }
}

internal class LabelStrategy extends ComponentStrategy {
    override internal function updateColumn2(prop2 : PropertyColumn2) : void {
        var compo : Label = Label(_componentWrapper.component);

        prop2.handlerLabel.visible = true;
        prop2.handlerText.visible = true;
        prop2.handlerText.text = _componentWrapper.handler;
        prop2.labelLabel.visible = true;
        prop2.labelLabel.text = 'Text';
        prop2.labelText.visible = true;
        prop2.labelText.text = compo.text;
        prop2.toggleCB.visible = false;
        prop2.selectedCB.visible = false;
        prop2.colorLabel.visible = false;
        prop2.colorChooser.visible = false;
    }

    override internal function updateFromColumn2Values(prop2 : PropertyColumn2) : void {
        Label(_componentWrapper.component).text = prop2.labelText.text;
    }

    override internal function updateColumn4(prop4 : PropertyColumn4) : void {
        prop4.restrictLabel.visible = false;
        prop4.restrictText.visible = false;
        prop4.maxCharsLabel.visible = false;
        prop4.maxCharsText.visible = false;
        prop4.passwordCB.visible = false;
        prop4.autosizeCB.visible = true;

        if (Label(_componentWrapper.component).autoSize) prop4.autosizeCB.selected = true;
        else prop4.autosizeCB.selected = false;

        prop4.editableCB.visible = false;
    }

    override internal function updateFromColumn4Values(prop4 : PropertyColumn4) : void {
        Label(_componentWrapper.component).autoSize = prop4.autosizeCB.selected;
    }

    override internal function generateCode(par0 : String, par1 : String, par2 : Number, par3 : Number, flag : int = 1) : String {
        var compo : Label = Label(_componentWrapper.component);

        if (flag) var out : String = 'var ' + par0 + ':' + par1 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3 + ', \'' + compo.text + '\');\n';
        else out = '\t\t\t' + par0 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3 + ', \'' + compo.text + '\');\n';

        if (!compo.autoSize) out += par0 + '.autoSize = false;\n';

        return out + '\n';
    }
}

internal class ProgressBarStrategy extends ComponentStrategy {
    override internal function updateColumn3(prop3 : PropertyColumn3) : void {
        var compo : ProgressBar = ProgressBar(_componentWrapper.component);

        prop3.maxLabel.visible = true;
        prop3.maxText.visible = true;
        prop3.maxText.text = compo.maximum.toString();
        prop3.minLabel.visible = false;
        prop3.minText.visible = false;
        prop3.valueLabel.visible = false;
        prop3.valueText.visible = false;
        prop3.tickLabel.visible = false;
        prop3.tickText.visible = false;
        prop3.precisionLabel.visible = false;
        prop3.precisionText.visible = false;
    }

    override internal function updateFromColumn3Values(prop3 : PropertyColumn3) : void {
        var compo : ProgressBar = ProgressBar(_componentWrapper.component);
        compo.maximum = Number(prop3.maxText.text);
    }

    override internal function generateCode(par0 : String, par1 : String, par2 : Number, par3 : Number, flag : int = 1) : String {
        var compo : ProgressBar = ProgressBar(_componentWrapper.component);

        if (flag) var out : String = 'var ' + par0 + ':' + par1 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3 + ');\n';
        else out = '\t\t\t' + par0 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3 + ');\n';

        if (compo.width != 100) out += par0 + '.width = ' + compo.width + ';\n';

        return out + '\n';
    }
}

internal class PushButtonStrategy extends ComponentStrategy {
    override internal function updateColumn2(prop2 : PropertyColumn2) : void {
        var compo : PushButton = PushButton(_componentWrapper.component);

        prop2.handlerLabel.visible = true;
        prop2.handlerText.visible = true;
        prop2.handlerText.text = _componentWrapper.handler;
        prop2.labelLabel.visible = true;
        prop2.labelLabel.text = 'Label';
        prop2.labelText.visible = true;
        prop2.labelText.text = compo.label;
        prop2.toggleCB.visible = true;
        prop2.toggleCB.selected = compo.toggle;
        prop2.selectedCB.visible = prop2.toggleCB.selected;
        prop2.selectedCB.selected = compo.selected;
        prop2.colorLabel.visible = false;
        prop2.colorChooser.visible = false;
    }

    override internal function updateFromColumn2Values(prop2 : PropertyColumn2) : void {
        var compo : PushButton = PushButton(_componentWrapper.component);
        _componentWrapper.handler = prop2.handlerText.text;
        compo.label = prop2.labelText.text;
        compo.toggle = prop2.toggleCB.selected;
        prop2.selectedCB.visible = prop2.toggleCB.selected;
    }

    override internal function generateCode(par0 : String, par1 : String, par2 : Number, par3 : Number, flag : int = 1) : String {
        var compo : PushButton = PushButton(_componentWrapper.component);

        if (flag) var out : String = 'var ' + par0 + ':' + par1 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3 + ', \'' + compo.label + '\'';
        else out = '\t\t\t' + par0 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3 + ', \'' + compo.label + '\'';

        if (_componentWrapper.handler != '') out += ', ' + _componentWrapper.handler;

        out += ');\n';

        if (compo.width != 100) out += par0 + '.width = ' + compo.width + ';\n';
        if (compo.height != 20) out += par0 + '.height = ' + compo.height + ';\n';
        if (compo.toggle) out += par0 + '.toggle = true;\n';
        if (compo.selected) out += par0 + '.selected = true;\n';

        return out + '\n';
    }
}

internal class RadioButtonStrategy extends ComponentStrategy {
    override internal function updateColumn2(prop2 : PropertyColumn2) : void {
        var compo : RadioButton = RadioButton(_componentWrapper.component);

        prop2.handlerLabel.visible = true;
        prop2.handlerText.visible = true;
        prop2.handlerText.text = _componentWrapper.handler;
        prop2.labelLabel.visible = true;
        prop2.labelLabel.text = 'Label';
        prop2.labelText.visible = true;
        prop2.labelText.text = compo.label;
        prop2.toggleCB.visible = false;
        prop2.selectedCB.visible = true;
        prop2.selectedCB.selected = compo.selected;
        prop2.colorLabel.visible = false;
        prop2.colorChooser.visible = false;
    }

    override internal function updateFromColumn2Values(prop2 : PropertyColumn2) : void {
        _componentWrapper.handler = prop2.handlerText.text;

        var compo : RadioButton = RadioButton(_componentWrapper.component);
        compo.label = prop2.labelText.text;
        compo.selected = prop2.selectedCB.selected;
    }

    override internal function generateCode(par0 : String, par1 : String, par2 : Number, par3 : Number, flag : int = 1) : String {
        var compo : RadioButton = RadioButton(_componentWrapper.component);

        if (flag) var out : String = 'var ' + par0 + ':' + par1 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3 + ', \'' + compo.label + '\'';
        else out = '\t\t\t' + par0 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3 + ', \'' + compo.label + '\'';

        if (_componentWrapper.handler != '') out += ', ' + _componentWrapper.handler;

        out += ');\n';

        if (compo.selected) out += par0 + '.selected = true;\n';

        return out + '\n';
    }
}

internal class TextStrategy extends ComponentStrategy {
    override internal function updateColumn2(prop2 : PropertyColumn2) : void {
        var compo : Text = Text(_componentWrapper.component);

        prop2.handlerLabel.visible = true;
        prop2.handlerText.visible = true;
        prop2.handlerText.text = _componentWrapper.handler;
        prop2.labelLabel.visible = true;
        prop2.labelLabel.text = 'Text';
        prop2.labelText.visible = true;
        prop2.labelText.text = compo.text;
        prop2.toggleCB.visible = false;
        prop2.selectedCB.visible = false;
        prop2.colorLabel.visible = false;
        prop2.colorChooser.visible = false;
    }

    override internal function updateFromColumn2Values(prop2 : PropertyColumn2) : void {
        Text(_componentWrapper.component).text = prop2.labelText.text;
    }

    override internal function updateColumn3(prop3 : PropertyColumn3) : void {
        prop3.maxLabel.visible = false;
        prop3.maxText.visible = false;
        prop3.minLabel.visible = false;
        prop3.minText.visible = false;
        prop3.valueLabel.visible = false;
        prop3.valueText.visible = false;
        prop3.tickLabel.visible = false;
        prop3.tickText.visible = false;
        prop3.precisionLabel.visible = false;
        prop3.precisionText.visible = false;
    }

    override internal function updateColumn4(prop4 : PropertyColumn4) : void {
        prop4.restrictLabel.visible = false;
        prop4.restrictText.visible = false;
        prop4.maxCharsLabel.visible = false;
        prop4.maxCharsText.visible = false;
        prop4.passwordCB.visible = false;
        prop4.autosizeCB.visible = false;
        prop4.editableCB.visible = true;
        prop4.editableCB.selected = Text(_componentWrapper.component).editable;
    }

    override internal function updateFromColumn4Values(prop4 : PropertyColumn4) : void {
        Text(_componentWrapper.component).editable = prop4.editableCB.selected;
    }

    override internal function generateCode(par0 : String, par1 : String, par2 : Number, par3 : Number, flag : int = 1) : String {
        var compo : Text = Text(_componentWrapper.component);

        if (flag) var out : String = 'var ' + par0 + ':' + par1 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3 + ', \'' + compo.text + '\');\n';
        else out = '\t\t\t' + par0 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3 + ', \'' + compo.text + '\');\n';

        if (compo.width != 200) out += par0 + '.width = ' + compo.width + ';\n';
        if (compo.height != 100) out += par0 + '.height = ' + compo.height + ';\n';
        if (!compo.editable) out += par0 + '.editable = false;\n';

        return out + '\n';
    }
}

internal class VSliderStrategy extends ComponentStrategy {
    override internal function updateColumn2(prop2 : PropertyColumn2) : void {
        prop2.handlerLabel.visible = true;
        prop2.handlerText.visible = true;
        prop2.handlerText.text = _componentWrapper.handler;
        prop2.labelLabel.visible = false;
        prop2.labelText.visible = false;
        prop2.toggleCB.visible = false;
        prop2.selectedCB.visible = false;
        prop2.colorLabel.visible = false;
        prop2.colorChooser.visible = false;
    }

    override internal function updateFromColumn2Values(prop2 : PropertyColumn2) : void {
        _componentWrapper.handler = prop2.handlerText.text;
    }

    override internal function updateColumn3(prop3 : PropertyColumn3) : void {
        var compo : VSlider = VSlider(_componentWrapper.component);
        prop3.maxLabel.visible = true;
        prop3.maxText.visible = true;
        prop3.maxText.text = compo.maximum.toString();
        prop3.minLabel.visible = true;
        prop3.minText.visible = true;
        prop3.minText.text = compo.minimum.toString();
        prop3.valueLabel.visible = true;
        prop3.valueText.visible = true;
        prop3.valueText.text = compo.value.toString();
        prop3.tickLabel.visible = true;
        prop3.tickText.visible = true;
        prop3.tickText.text = compo.tick.toString();
        prop3.precisionLabel.visible = false;
        prop3.precisionText.visible = false;
    }

    override internal function updateFromColumn3Values(prop3 : PropertyColumn3) : void {
        var compo : VSlider = VSlider(_componentWrapper.component);
        compo.maximum = Number(prop3.maxText.text);
        compo.minimum = Number(prop3.minText.text);
        compo.value = Number(prop3.valueText.text);
        compo.tick = Number(prop3.tickText.text);
    }

    override internal function generateCode(par0 : String, par1 : String, par2 : Number, par3 : Number, flag : int = 1) : String {
        var compo : VSlider = VSlider(_componentWrapper.component);

        if (flag) var out : String = 'var ' + par0 + ':' + par1 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3;
        else out = '\t\t\t' + par0 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3;

        if (_componentWrapper.handler != '') out += ', ' + _componentWrapper.handler;

        out += ');\n';

        if (compo.height != 100) out += par0 + '.height = ' + compo.height + ';\n';
        if (compo.maximum != 100) out += par0 + '.maximum = ' + compo.maximum + ';\n';
        if (compo.minimum != 0) out += par0 + '.minimum = ' + compo.minimum + ';\n';
        if (compo.value != 0) out += par0 + '.value = ' + compo.value + ';\n';
        if (compo.tick != 1) out += par0 + '.tick = ' + compo.tick + ';\n';

        return out + '\n';
    }
}

internal class VUISliderStrategy extends ComponentStrategy {
    override internal function updateColumn2(prop2 : PropertyColumn2) : void {
        var compo : VUISlider = VUISlider(_componentWrapper.component);

        prop2.handlerLabel.visible = true;
        prop2.handlerText.visible = true;
        prop2.handlerText.text = _componentWrapper.handler;
        prop2.labelLabel.visible = true;
        prop2.labelLabel.text = 'Label';
        prop2.labelText.visible = true;
        prop2.labelText.text = compo.label;
        prop2.toggleCB.visible = false;
        prop2.selectedCB.visible = false;
        prop2.colorLabel.visible = false;
        prop2.colorChooser.visible = false;
    }

    override internal function updateFromColumn2Values(prop2 : PropertyColumn2) : void {
        _componentWrapper.handler = prop2.handlerText.text;

        VUISlider(_componentWrapper.component).label = prop2.labelText.text;
    }

    override internal function updateColumn3(prop3 : PropertyColumn3) : void {
        var compo : VUISlider = VUISlider(_componentWrapper.component);
        prop3.maxLabel.visible = true;
        prop3.maxText.visible = true;
        prop3.maxText.text = compo.maximum.toString();
        prop3.minLabel.visible = true;
        prop3.minText.visible = true;
        prop3.minText.text = compo.minimum.toString();
        prop3.valueLabel.visible = true;
        prop3.valueText.visible = true;
        prop3.valueText.text = compo.value.toString();
        prop3.tickLabel.visible = true;
        prop3.tickText.visible = true;
        prop3.tickText.text = compo.tick.toString();
        prop3.precisionLabel.visible = true;
        prop3.precisionText.visible = true;
        prop3.precisionText.text = compo.labelPrecision.toString();
    }

    override internal function updateFromColumn3Values(prop3 : PropertyColumn3) : void {
        var compo : VUISlider = VUISlider(_componentWrapper.component);
        compo.maximum = Number(prop3.maxText.text);
        compo.minimum = Number(prop3.minText.text);
        compo.value = Number(prop3.valueText.text);
        compo.tick = Number(prop3.tickText.text);
        compo.labelPrecision = Number(prop3.precisionText.text);
    }

    override internal function generateCode(par0 : String, par1 : String, par2 : Number, par3 : Number, flag : int = 1) : String {
        var compo : VUISlider = VUISlider(_componentWrapper.component);

        if (flag) var out : String = 'var ' + par0 + ':' + par1 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3 + ', \'' + compo.label + '\'';
        else out = '\t\t\t' + par0 + ' = new ' + par1 + '(this, ' + par2 + ', ' + par3 + ', \'' + compo.label + '\'';

        if (_componentWrapper.handler != '') out += ', ' + _componentWrapper.handler;

        out += ');\n';

        if (compo.height != 146) out += par0 + '.height = ' + compo.height + ';\n';
        if (compo.maximum != 100) out += par0 + '.maximum = ' + compo.maximum + ';\n';
        if (compo.minimum != 0) out += par0 + '.minimum = ' + compo.minimum + ';\n';
        if (compo.value != 0) out += par0 + '.value = ' + compo.value + ';\n';
        if (compo.tick != 1) out += par0 + '.tick = ' + compo.tick + ';\n';
        if (compo.labelPrecision != 1) out += par0 + '.labelPrecision = ' + compo.labelPrecision + ';\n';

        return out + '\n';
    }
}