home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2012 April / ME_04_2012.iso / Video-Tutorial / iPhoto / media / player.swf / scripts / mx / controls / Button.as next >
Encoding:
Text File  |  2011-11-11  |  42.6 KB  |  1,267 lines

  1. package mx.controls
  2. {
  3.    import flash.display.DisplayObject;
  4.    import flash.events.Event;
  5.    import flash.events.FocusEvent;
  6.    import flash.events.KeyboardEvent;
  7.    import flash.events.MouseEvent;
  8.    import flash.events.TimerEvent;
  9.    import flash.text.TextFormatAlign;
  10.    import flash.text.TextLineMetrics;
  11.    import flash.ui.Keyboard;
  12.    import flash.utils.Timer;
  13.    import mx.controls.dataGridClasses.DataGridListData;
  14.    import mx.controls.listClasses.BaseListData;
  15.    import mx.controls.listClasses.IDropInListItemRenderer;
  16.    import mx.controls.listClasses.IListItemRenderer;
  17.    import mx.core.EdgeMetrics;
  18.    import mx.core.FlexVersion;
  19.    import mx.core.IBorder;
  20.    import mx.core.IButton;
  21.    import mx.core.IDataRenderer;
  22.    import mx.core.IFlexAsset;
  23.    import mx.core.IFlexDisplayObject;
  24.    import mx.core.IFlexModuleFactory;
  25.    import mx.core.IFontContextComponent;
  26.    import mx.core.IInvalidating;
  27.    import mx.core.ILayoutDirectionElement;
  28.    import mx.core.IProgrammaticSkin;
  29.    import mx.core.IStateClient;
  30.    import mx.core.IUIComponent;
  31.    import mx.core.IUITextField;
  32.    import mx.core.UIComponent;
  33.    import mx.core.UITextField;
  34.    import mx.core.mx_internal;
  35.    import mx.events.FlexEvent;
  36.    import mx.events.MoveEvent;
  37.    import mx.events.SandboxMouseEvent;
  38.    import mx.managers.IFocusManagerComponent;
  39.    import mx.styles.ISimpleStyleClient;
  40.    
  41.    use namespace mx_internal;
  42.    
  43.    public class Button extends UIComponent implements IDataRenderer, IDropInListItemRenderer, IFocusManagerComponent, IListItemRenderer, IFontContextComponent, IButton
  44.    {
  45.       mx_internal static var createAccessibilityImplementation:Function;
  46.       
  47.       mx_internal static const VERSION:String = "4.5.0.20967";
  48.       
  49.       mx_internal static var TEXT_WIDTH_PADDING:Number = UITextField.mx_internal::TEXT_WIDTH_PADDING + 1;
  50.       
  51.       private var skins:Array = [];
  52.       
  53.       mx_internal var currentSkin:IFlexDisplayObject;
  54.       
  55.       protected var icons:Array = [];
  56.       
  57.       mx_internal var currentIcon:IFlexDisplayObject;
  58.       
  59.       private var autoRepeatTimer:Timer;
  60.       
  61.       mx_internal var buttonOffset:Number = 0;
  62.       
  63.       mx_internal var centerContent:Boolean = true;
  64.       
  65.       mx_internal var extraSpacing:Number = 20;
  66.       
  67.       private var styleChangedFlag:Boolean = true;
  68.       
  69.       private var skinMeasuredWidth:Number;
  70.       
  71.       private var skinMeasuredHeight:Number;
  72.       
  73.       private var oldUnscaledWidth:Number;
  74.       
  75.       private var selectedSet:Boolean;
  76.       
  77.       private var labelSet:Boolean;
  78.       
  79.       mx_internal var checkedDefaultSkin:Boolean = false;
  80.       
  81.       mx_internal var defaultSkinUsesStates:Boolean = false;
  82.       
  83.       mx_internal var checkedDefaultIcon:Boolean = false;
  84.       
  85.       mx_internal var defaultIconUsesStates:Boolean = false;
  86.       
  87.       mx_internal var skinName:String = "skin";
  88.       
  89.       mx_internal var emphasizedSkinName:String = "emphasizedSkin";
  90.       
  91.       mx_internal var upSkinName:String = "upSkin";
  92.       
  93.       mx_internal var overSkinName:String = "overSkin";
  94.       
  95.       mx_internal var downSkinName:String = "downSkin";
  96.       
  97.       mx_internal var disabledSkinName:String = "disabledSkin";
  98.       
  99.       mx_internal var selectedUpSkinName:String = "selectedUpSkin";
  100.       
  101.       mx_internal var selectedOverSkinName:String = "selectedOverSkin";
  102.       
  103.       mx_internal var selectedDownSkinName:String = "selectedDownSkin";
  104.       
  105.       mx_internal var selectedDisabledSkinName:String = "selectedDisabledSkin";
  106.       
  107.       mx_internal var iconName:String = "icon";
  108.       
  109.       mx_internal var upIconName:String = "upIcon";
  110.       
  111.       mx_internal var overIconName:String = "overIcon";
  112.       
  113.       mx_internal var downIconName:String = "downIcon";
  114.       
  115.       mx_internal var disabledIconName:String = "disabledIcon";
  116.       
  117.       mx_internal var selectedUpIconName:String = "selectedUpIcon";
  118.       
  119.       mx_internal var selectedOverIconName:String = "selectedOverIcon";
  120.       
  121.       mx_internal var selectedDownIconName:String = "selectedDownIcon";
  122.       
  123.       mx_internal var selectedDisabledIconName:String = "selectedDisabledIcon";
  124.       
  125.       private var enabledChanged:Boolean = false;
  126.       
  127.       protected var textField:IUITextField;
  128.       
  129.       private var toolTipSet:Boolean = false;
  130.       
  131.       private var _autoRepeat:Boolean = false;
  132.       
  133.       private var _data:Object;
  134.       
  135.       mx_internal var _emphasized:Boolean = false;
  136.       
  137.       private var emphasizedChanged:Boolean = false;
  138.       
  139.       private var _label:String = "";
  140.       
  141.       private var labelChanged:Boolean = false;
  142.       
  143.       mx_internal var _labelPlacement:String = "right";
  144.       
  145.       private var _listData:BaseListData;
  146.       
  147.       private var _phase:String = "up";
  148.       
  149.       mx_internal var phaseChanged:Boolean = false;
  150.       
  151.       mx_internal var _selected:Boolean = false;
  152.       
  153.       public var selectedField:String = null;
  154.       
  155.       private var skinLayoutDirectionSet:Boolean = false;
  156.       
  157.       private var _skinLayoutDirection:String;
  158.       
  159.       public var stickyHighlighting:Boolean = false;
  160.       
  161.       mx_internal var _toggle:Boolean = false;
  162.       
  163.       mx_internal var toggleChanged:Boolean = false;
  164.       
  165.       protected var _currentButtonState:String;
  166.       
  167.       public function Button()
  168.       {
  169.          super();
  170.          mouseChildren = false;
  171.          addEventListener(MouseEvent.ROLL_OVER,this.rollOverHandler);
  172.          addEventListener(MouseEvent.ROLL_OUT,this.rollOutHandler);
  173.          addEventListener(MouseEvent.MOUSE_DOWN,this.mouseDownHandler);
  174.          addEventListener(MouseEvent.MOUSE_UP,this.mouseUpHandler);
  175.          addEventListener(MouseEvent.CLICK,this.clickHandler);
  176.       }
  177.       
  178.       override public function get baselinePosition() : Number
  179.       {
  180.          if(!mx_internal::validateBaselinePosition())
  181.          {
  182.             return NaN;
  183.          }
  184.          return this.textField.y + this.textField.baselinePosition;
  185.       }
  186.       
  187.       override public function set enabled(param1:Boolean) : void
  188.       {
  189.          if(super.enabled == param1)
  190.          {
  191.             return;
  192.          }
  193.          super.enabled = param1;
  194.          this.enabledChanged = true;
  195.          invalidateProperties();
  196.          invalidateDisplayList();
  197.       }
  198.       
  199.       override public function set toolTip(param1:String) : void
  200.       {
  201.          super.toolTip = param1;
  202.          if(param1)
  203.          {
  204.             this.toolTipSet = true;
  205.          }
  206.          else
  207.          {
  208.             this.toolTipSet = false;
  209.             invalidateDisplayList();
  210.          }
  211.       }
  212.       
  213.       public function get autoRepeat() : Boolean
  214.       {
  215.          return this._autoRepeat;
  216.       }
  217.       
  218.       public function set autoRepeat(param1:Boolean) : void
  219.       {
  220.          this._autoRepeat = param1;
  221.          if(param1)
  222.          {
  223.             this.autoRepeatTimer = new Timer(1);
  224.          }
  225.          else
  226.          {
  227.             this.autoRepeatTimer = null;
  228.          }
  229.       }
  230.       
  231.       [Bindable("dataChange")]
  232.       public function get data() : Object
  233.       {
  234.          return this._data;
  235.       }
  236.       
  237.       public function set data(param1:Object) : void
  238.       {
  239.          var _loc2_:* = undefined;
  240.          var _loc3_:* = undefined;
  241.          this._data = param1;
  242.          if(this._listData && this._listData is DataGridListData && DataGridListData(this._listData).dataField != null)
  243.          {
  244.             _loc2_ = this._data[DataGridListData(this._listData).dataField];
  245.             _loc3_ = "";
  246.          }
  247.          else if(this._listData)
  248.          {
  249.             if(this.selectedField)
  250.             {
  251.                _loc2_ = this._data[this.selectedField];
  252.             }
  253.             _loc3_ = this._listData.label;
  254.          }
  255.          else
  256.          {
  257.             _loc2_ = this._data;
  258.          }
  259.          if(_loc2_ !== undefined && !this.selectedSet)
  260.          {
  261.             this.selected = _loc2_ as Boolean;
  262.             this.selectedSet = false;
  263.          }
  264.          if(_loc3_ !== undefined && !this.labelSet)
  265.          {
  266.             this.label = _loc3_;
  267.             this.labelSet = false;
  268.          }
  269.          dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
  270.       }
  271.       
  272.       public function get emphasized() : Boolean
  273.       {
  274.          return this.mx_internal::_emphasized;
  275.       }
  276.       
  277.       public function set emphasized(param1:Boolean) : void
  278.       {
  279.          this.mx_internal::_emphasized = param1;
  280.          this.emphasizedChanged = true;
  281.          invalidateDisplayList();
  282.       }
  283.       
  284.       public function get fontContext() : IFlexModuleFactory
  285.       {
  286.          return moduleFactory;
  287.       }
  288.       
  289.       public function set fontContext(param1:IFlexModuleFactory) : void
  290.       {
  291.          this.moduleFactory = param1;
  292.       }
  293.       
  294.       [Bindable("labelChanged")]
  295.       public function get label() : String
  296.       {
  297.          return this._label;
  298.       }
  299.       
  300.       public function set label(param1:String) : void
  301.       {
  302.          this.labelSet = true;
  303.          if(this._label != param1)
  304.          {
  305.             this._label = param1;
  306.             this.labelChanged = true;
  307.             invalidateSize();
  308.             invalidateDisplayList();
  309.             dispatchEvent(new Event("labelChanged"));
  310.          }
  311.       }
  312.       
  313.       [Bindable("labelPlacementChanged")]
  314.       public function get labelPlacement() : String
  315.       {
  316.          return this.mx_internal::_labelPlacement;
  317.       }
  318.       
  319.       public function set labelPlacement(param1:String) : void
  320.       {
  321.          this.mx_internal::_labelPlacement = param1;
  322.          invalidateSize();
  323.          invalidateDisplayList();
  324.          dispatchEvent(new Event("labelPlacementChanged"));
  325.       }
  326.       
  327.       [Bindable("dataChange")]
  328.       public function get listData() : BaseListData
  329.       {
  330.          return this._listData;
  331.       }
  332.       
  333.       public function set listData(param1:BaseListData) : void
  334.       {
  335.          this._listData = param1;
  336.       }
  337.       
  338.       mx_internal function get phase() : String
  339.       {
  340.          return this._phase;
  341.       }
  342.       
  343.       mx_internal function set phase(param1:String) : void
  344.       {
  345.          this._phase = param1;
  346.          this.mx_internal::phaseChanged = true;
  347.          invalidateSize();
  348.          invalidateProperties();
  349.          invalidateDisplayList();
  350.       }
  351.       
  352.       [Bindable("valueCommit")]
  353.       [Bindable("click")]
  354.       public function get selected() : Boolean
  355.       {
  356.          return this.mx_internal::_selected;
  357.       }
  358.       
  359.       public function set selected(param1:Boolean) : void
  360.       {
  361.          this.selectedSet = true;
  362.          this.mx_internal::setSelected(param1,true);
  363.       }
  364.       
  365.       mx_internal function setSelected(param1:Boolean, param2:Boolean = false) : void
  366.       {
  367.          if(this.mx_internal::_selected != param1)
  368.          {
  369.             this.mx_internal::_selected = param1;
  370.             invalidateDisplayList();
  371.             if(this.toggle && !param2)
  372.             {
  373.                dispatchEvent(new Event(Event.CHANGE));
  374.             }
  375.             dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  376.          }
  377.       }
  378.       
  379.       mx_internal function set skinLayoutDirection(param1:String) : void
  380.       {
  381.          this.skinLayoutDirectionSet = true;
  382.          this._skinLayoutDirection = param1;
  383.       }
  384.       
  385.       [Bindable("toggleChanged")]
  386.       public function get toggle() : Boolean
  387.       {
  388.          return this.mx_internal::_toggle;
  389.       }
  390.       
  391.       public function set toggle(param1:Boolean) : void
  392.       {
  393.          this.mx_internal::_toggle = param1;
  394.          this.mx_internal::toggleChanged = true;
  395.          invalidateProperties();
  396.          invalidateDisplayList();
  397.          dispatchEvent(new Event("toggleChanged"));
  398.       }
  399.       
  400.       override protected function initializeAccessibility() : void
  401.       {
  402.          if(Button.mx_internal::createAccessibilityImplementation != null)
  403.          {
  404.             Button.mx_internal::createAccessibilityImplementation(this);
  405.          }
  406.       }
  407.       
  408.       override protected function createChildren() : void
  409.       {
  410.          super.createChildren();
  411.          if(!this.textField)
  412.          {
  413.             this.textField = IUITextField(createInFontContext(UITextField));
  414.             this.textField.styleName = this;
  415.             addChild(DisplayObject(this.textField));
  416.          }
  417.       }
  418.       
  419.       override protected function commitProperties() : void
  420.       {
  421.          var _loc1_:String = null;
  422.          super.commitProperties();
  423.          if(hasFontContextChanged() && this.textField != null)
  424.          {
  425.             removeChild(DisplayObject(this.textField));
  426.             this.textField = null;
  427.          }
  428.          if(!this.textField)
  429.          {
  430.             this.textField = IUITextField(createInFontContext(UITextField));
  431.             this.textField.styleName = this;
  432.             addChild(DisplayObject(this.textField));
  433.             this.enabledChanged = true;
  434.             this.mx_internal::toggleChanged = true;
  435.          }
  436.          if(!initialized)
  437.          {
  438.             this.mx_internal::viewSkin();
  439.             this.mx_internal::viewIcon();
  440.          }
  441.          if(this.enabledChanged)
  442.          {
  443.             this.textField.enabled = enabled;
  444.             if(Boolean(this.mx_internal::currentIcon) && this.mx_internal::currentIcon is IUIComponent)
  445.             {
  446.                IUIComponent(this.mx_internal::currentIcon).enabled = enabled;
  447.             }
  448.             this.enabledChanged = false;
  449.          }
  450.          if(this.mx_internal::toggleChanged)
  451.          {
  452.             if(!this.toggle)
  453.             {
  454.                this.selected = false;
  455.             }
  456.             this.mx_internal::toggleChanged = false;
  457.          }
  458.          if(this.mx_internal::phaseChanged)
  459.          {
  460.             _loc1_ = this._currentButtonState;
  461.             if(_loc1_ != this.mx_internal::getCurrentButtonState())
  462.             {
  463.                stateChanged(_loc1_,this._currentButtonState,false);
  464.             }
  465.             this.mx_internal::phaseChanged = false;
  466.          }
  467.       }
  468.       
  469.       override protected function measure() : void
  470.       {
  471.          var _loc9_:TextLineMetrics = null;
  472.          super.measure();
  473.          var _loc1_:Number = 0;
  474.          var _loc2_:Number = 0;
  475.          if(this.label)
  476.          {
  477.             _loc9_ = measureText(this.label);
  478.             _loc1_ = _loc9_.width + mx_internal::TEXT_WIDTH_PADDING;
  479.             _loc2_ = _loc9_.height + UITextField.mx_internal::TEXT_HEIGHT_PADDING;
  480.          }
  481.          var _loc3_:IFlexDisplayObject = this.mx_internal::getCurrentIcon();
  482.          var _loc4_:Number = !!_loc3_ ? Number(_loc3_.width) : 0;
  483.          var _loc5_:Number = !!_loc3_ ? Number(_loc3_.height) : 0;
  484.          var _loc6_:Number = 0;
  485.          var _loc7_:Number = 0;
  486.          if(this.labelPlacement == ButtonLabelPlacement.LEFT || this.labelPlacement == ButtonLabelPlacement.RIGHT)
  487.          {
  488.             _loc6_ = _loc1_ + _loc4_;
  489.             if(Boolean(_loc1_) && Boolean(_loc4_))
  490.             {
  491.                _loc6_ += getStyle("horizontalGap");
  492.             }
  493.             _loc7_ = Math.max(_loc2_,_loc5_);
  494.          }
  495.          else
  496.          {
  497.             _loc6_ = Math.max(_loc1_,_loc4_);
  498.             _loc7_ = _loc2_ + _loc5_;
  499.             if(Boolean(_loc2_) && Boolean(_loc5_))
  500.             {
  501.                _loc7_ += getStyle("verticalGap");
  502.             }
  503.          }
  504.          if(Boolean(_loc1_) || Boolean(_loc4_))
  505.          {
  506.             _loc6_ += getStyle("paddingLeft") + getStyle("paddingRight");
  507.             _loc7_ += getStyle("paddingTop") + getStyle("paddingBottom");
  508.          }
  509.          var _loc8_:EdgeMetrics = this.mx_internal::currentSkin && this.mx_internal::currentSkin is IBorder && !(this.mx_internal::currentSkin is IFlexAsset) ? IBorder(this.mx_internal::currentSkin).borderMetrics : null;
  510.          if(_loc8_)
  511.          {
  512.             _loc6_ += _loc8_.left + _loc8_.right;
  513.             _loc7_ += _loc8_.top + _loc8_.bottom;
  514.          }
  515.          if(Boolean(this.mx_internal::currentSkin) && (isNaN(this.skinMeasuredWidth) || isNaN(this.skinMeasuredHeight)))
  516.          {
  517.             this.skinMeasuredWidth = this.mx_internal::currentSkin.measuredWidth;
  518.             this.skinMeasuredHeight = this.mx_internal::currentSkin.measuredHeight;
  519.          }
  520.          if(!isNaN(this.skinMeasuredWidth))
  521.          {
  522.             _loc6_ = Math.max(this.skinMeasuredWidth,_loc6_);
  523.          }
  524.          if(!isNaN(this.skinMeasuredHeight))
  525.          {
  526.             _loc7_ = Math.max(this.skinMeasuredHeight,_loc7_);
  527.          }
  528.          measuredMinWidth = measuredWidth = _loc6_;
  529.          measuredMinHeight = measuredHeight = _loc7_;
  530.       }
  531.       
  532.       override protected function updateDisplayList(param1:Number, param2:Number) : void
  533.       {
  534.          var _loc5_:IFlexDisplayObject = null;
  535.          var _loc6_:Boolean = false;
  536.          super.updateDisplayList(param1,param2);
  537.          if(this.emphasizedChanged)
  538.          {
  539.             this.mx_internal::changeSkins();
  540.             this.emphasizedChanged = false;
  541.          }
  542.          var _loc3_:int = int(this.skins.length);
  543.          var _loc4_:int = 0;
  544.          while(_loc4_ < _loc3_)
  545.          {
  546.             _loc5_ = IFlexDisplayObject(this.skins[_loc4_]);
  547.             _loc5_.setActualSize(param1,param2);
  548.             _loc4_++;
  549.          }
  550.          this.mx_internal::viewSkin();
  551.          this.mx_internal::viewIcon();
  552.          this.mx_internal::layoutContents(param1,param2,this.mx_internal::phase == ButtonPhase.DOWN);
  553.          if(this.oldUnscaledWidth > param1 || this.textField.text != this.label || this.labelChanged || this.styleChangedFlag)
  554.          {
  555.             this.textField.text = this.label;
  556.             _loc6_ = this.textField.truncateToFit();
  557.             if(!this.toolTipSet)
  558.             {
  559.                if(_loc6_)
  560.                {
  561.                   super.toolTip = this.label;
  562.                }
  563.                else
  564.                {
  565.                   super.toolTip = null;
  566.                }
  567.             }
  568.             this.styleChangedFlag = false;
  569.             this.labelChanged = false;
  570.          }
  571.          this.oldUnscaledWidth = param1;
  572.       }
  573.       
  574.       override public function styleChanged(param1:String) : void
  575.       {
  576.          this.styleChangedFlag = true;
  577.          super.styleChanged(param1);
  578.          if(!param1 || param1 == "styleName")
  579.          {
  580.             this.mx_internal::changeSkins();
  581.             this.mx_internal::changeIcons();
  582.             if(initialized)
  583.             {
  584.                this.mx_internal::viewSkin();
  585.                this.mx_internal::viewIcon();
  586.             }
  587.          }
  588.          else if(param1.toLowerCase().indexOf("skin") != -1)
  589.          {
  590.             this.mx_internal::changeSkins();
  591.          }
  592.          else if(param1.toLowerCase().indexOf("icon") != -1)
  593.          {
  594.             this.mx_internal::changeIcons();
  595.             invalidateSize();
  596.          }
  597.       }
  598.       
  599.       override protected function adjustFocusRect(param1:DisplayObject = null) : void
  600.       {
  601.          super.adjustFocusRect(!this.mx_internal::currentSkin ? DisplayObject(this.mx_internal::currentIcon) : this);
  602.       }
  603.       
  604.       override protected function get currentCSSState() : String
  605.       {
  606.          return this.mx_internal::getCurrentButtonState();
  607.       }
  608.       
  609.       mx_internal function viewSkin() : void
  610.       {
  611.          var _loc1_:String = null;
  612.          if(!enabled)
  613.          {
  614.             _loc1_ = this.selected ? this.mx_internal::selectedDisabledSkinName : this.mx_internal::disabledSkinName;
  615.          }
  616.          else if(this.mx_internal::phase == ButtonPhase.UP)
  617.          {
  618.             _loc1_ = this.selected ? this.mx_internal::selectedUpSkinName : this.mx_internal::upSkinName;
  619.          }
  620.          else if(this.mx_internal::phase == ButtonPhase.OVER)
  621.          {
  622.             _loc1_ = this.selected ? this.mx_internal::selectedOverSkinName : this.mx_internal::overSkinName;
  623.          }
  624.          else if(this.mx_internal::phase == ButtonPhase.DOWN)
  625.          {
  626.             _loc1_ = this.selected ? this.mx_internal::selectedDownSkinName : this.mx_internal::downSkinName;
  627.          }
  628.          this.mx_internal::viewSkinForPhase(_loc1_,this.mx_internal::getCurrentButtonState());
  629.       }
  630.       
  631.       mx_internal function viewSkinForPhase(param1:String, param2:String) : void
  632.       {
  633.          var _loc4_:IFlexDisplayObject = null;
  634.          var _loc5_:Number = NaN;
  635.          var _loc6_:ISimpleStyleClient = null;
  636.          var _loc3_:Class = Class(getStyle(param1));
  637.          if(!_loc3_)
  638.          {
  639.             _loc3_ = this.mx_internal::_emphasized ? Class(getStyle(this.mx_internal::emphasizedSkinName)) : Class(getStyle(this.mx_internal::skinName));
  640.             _loc3_ = !_loc3_ && this.mx_internal::_emphasized ? Class(getStyle(this.mx_internal::skinName)) : _loc3_;
  641.             if(this.mx_internal::defaultSkinUsesStates)
  642.             {
  643.                param1 = this.mx_internal::skinName;
  644.             }
  645.             if(!this.mx_internal::checkedDefaultSkin && Boolean(_loc3_))
  646.             {
  647.                _loc4_ = IFlexDisplayObject(new _loc3_());
  648.                if(!(_loc4_ is IProgrammaticSkin) && _loc4_ is IStateClient)
  649.                {
  650.                   this.mx_internal::defaultSkinUsesStates = true;
  651.                   param1 = this.mx_internal::skinName;
  652.                }
  653.                if(_loc4_)
  654.                {
  655.                   this.mx_internal::checkedDefaultSkin = true;
  656.                   if(_loc4_ is ILayoutDirectionElement && this.skinLayoutDirectionSet)
  657.                   {
  658.                      ILayoutDirectionElement(_loc4_).layoutDirection = this._skinLayoutDirection;
  659.                   }
  660.                }
  661.             }
  662.          }
  663.          _loc4_ = IFlexDisplayObject(getChildByName(param1));
  664.          if(!_loc4_)
  665.          {
  666.             if(_loc3_)
  667.             {
  668.                _loc4_ = IFlexDisplayObject(new _loc3_());
  669.                _loc4_.name = param1;
  670.                _loc6_ = _loc4_ as ISimpleStyleClient;
  671.                if(_loc6_)
  672.                {
  673.                   _loc6_.styleName = this;
  674.                }
  675.                if(_loc4_ is ILayoutDirectionElement && this.skinLayoutDirectionSet)
  676.                {
  677.                   ILayoutDirectionElement(_loc4_).layoutDirection = this._skinLayoutDirection;
  678.                }
  679.                addChild(DisplayObject(_loc4_));
  680.                _loc4_.setActualSize(unscaledWidth,unscaledHeight);
  681.                if(_loc4_ is IInvalidating && initialized)
  682.                {
  683.                   IInvalidating(_loc4_).validateNow();
  684.                }
  685.                else if(_loc4_ is IProgrammaticSkin && initialized)
  686.                {
  687.                   IProgrammaticSkin(_loc4_).validateDisplayList();
  688.                }
  689.                this.skins.push(_loc4_);
  690.             }
  691.          }
  692.          if(this.mx_internal::currentSkin)
  693.          {
  694.             this.mx_internal::currentSkin.visible = false;
  695.          }
  696.          this.mx_internal::currentSkin = _loc4_;
  697.          if(this.mx_internal::defaultSkinUsesStates && this.mx_internal::currentSkin is IStateClient)
  698.          {
  699.             IStateClient(this.mx_internal::currentSkin).currentState = param2;
  700.             if(this.mx_internal::currentSkin is IInvalidating)
  701.             {
  702.                IInvalidating(this.mx_internal::currentSkin).validateNow();
  703.             }
  704.          }
  705.          if(this.mx_internal::currentSkin)
  706.          {
  707.             this.mx_internal::currentSkin.visible = true;
  708.          }
  709.          if(enabled)
  710.          {
  711.             if(this.mx_internal::phase == ButtonPhase.OVER)
  712.             {
  713.                _loc5_ = this.textField.getStyle("textRollOverColor");
  714.             }
  715.             else if(this.mx_internal::phase == ButtonPhase.DOWN)
  716.             {
  717.                _loc5_ = this.textField.getStyle("textSelectedColor");
  718.             }
  719.             else
  720.             {
  721.                _loc5_ = this.textField.getStyle("color");
  722.             }
  723.             this.textField.setColor(_loc5_);
  724.          }
  725.       }
  726.       
  727.       mx_internal function getCurrentIconName() : String
  728.       {
  729.          var _loc1_:String = null;
  730.          if(!enabled)
  731.          {
  732.             _loc1_ = this.selected ? this.mx_internal::selectedDisabledIconName : this.mx_internal::disabledIconName;
  733.          }
  734.          else if(this.mx_internal::phase == ButtonPhase.UP)
  735.          {
  736.             _loc1_ = this.selected ? this.mx_internal::selectedUpIconName : this.mx_internal::upIconName;
  737.          }
  738.          else if(this.mx_internal::phase == ButtonPhase.OVER)
  739.          {
  740.             _loc1_ = this.selected ? this.mx_internal::selectedOverIconName : this.mx_internal::overIconName;
  741.          }
  742.          else if(this.mx_internal::phase == ButtonPhase.DOWN)
  743.          {
  744.             _loc1_ = this.selected ? this.mx_internal::selectedDownIconName : this.mx_internal::downIconName;
  745.          }
  746.          return _loc1_;
  747.       }
  748.       
  749.       mx_internal function getCurrentIcon() : IFlexDisplayObject
  750.       {
  751.          var _loc1_:String = this.mx_internal::getCurrentIconName();
  752.          if(!_loc1_)
  753.          {
  754.             return null;
  755.          }
  756.          return this.mx_internal::viewIconForPhase(_loc1_);
  757.       }
  758.       
  759.       mx_internal function viewIcon() : void
  760.       {
  761.          var _loc1_:String = this.mx_internal::getCurrentIconName();
  762.          this.mx_internal::viewIconForPhase(_loc1_);
  763.       }
  764.       
  765.       mx_internal function viewIconForPhase(param1:String) : IFlexDisplayObject
  766.       {
  767.          var _loc3_:IFlexDisplayObject = null;
  768.          var _loc4_:Boolean = false;
  769.          var _loc2_:Class = Class(getStyle(param1));
  770.          if(!_loc2_)
  771.          {
  772.             _loc2_ = Class(getStyle(this.mx_internal::iconName));
  773.             if(this.mx_internal::defaultIconUsesStates)
  774.             {
  775.                param1 = this.mx_internal::iconName;
  776.             }
  777.             if(!this.mx_internal::checkedDefaultIcon && Boolean(_loc2_))
  778.             {
  779.                _loc3_ = IFlexDisplayObject(new _loc2_());
  780.                if(!(_loc3_ is IProgrammaticSkin) && _loc3_ is IStateClient)
  781.                {
  782.                   this.mx_internal::defaultIconUsesStates = true;
  783.                   param1 = this.mx_internal::iconName;
  784.                }
  785.                if(_loc3_)
  786.                {
  787.                   this.mx_internal::checkedDefaultIcon = true;
  788.                }
  789.             }
  790.          }
  791.          _loc3_ = IFlexDisplayObject(getChildByName(param1));
  792.          if(_loc3_ == null)
  793.          {
  794.             if(_loc2_ != null)
  795.             {
  796.                _loc3_ = IFlexDisplayObject(new _loc2_());
  797.                _loc3_.name = param1;
  798.                if(_loc3_ is ISimpleStyleClient)
  799.                {
  800.                   ISimpleStyleClient(_loc3_).styleName = this;
  801.                }
  802.                addChild(DisplayObject(_loc3_));
  803.                _loc4_ = false;
  804.                if(_loc3_ is IInvalidating)
  805.                {
  806.                   IInvalidating(_loc3_).validateNow();
  807.                   _loc4_ = true;
  808.                }
  809.                else if(_loc3_ is IProgrammaticSkin)
  810.                {
  811.                   IProgrammaticSkin(_loc3_).validateDisplayList();
  812.                   _loc4_ = true;
  813.                }
  814.                if(Boolean(_loc3_) && _loc3_ is IUIComponent)
  815.                {
  816.                   IUIComponent(_loc3_).enabled = enabled;
  817.                }
  818.                if(_loc4_)
  819.                {
  820.                   _loc3_.setActualSize(_loc3_.measuredWidth,_loc3_.measuredHeight);
  821.                }
  822.                this.icons.push(_loc3_);
  823.             }
  824.          }
  825.          if(this.mx_internal::currentIcon != null)
  826.          {
  827.             this.mx_internal::currentIcon.visible = false;
  828.          }
  829.          this.mx_internal::currentIcon = _loc3_;
  830.          if(this.mx_internal::defaultIconUsesStates && this.mx_internal::currentIcon is IStateClient)
  831.          {
  832.             IStateClient(this.mx_internal::currentIcon).currentState = this.mx_internal::getCurrentButtonState();
  833.             if(this.mx_internal::currentIcon is IInvalidating)
  834.             {
  835.                IInvalidating(this.mx_internal::currentIcon).validateNow();
  836.             }
  837.          }
  838.          if(this.mx_internal::currentIcon != null)
  839.          {
  840.             this.mx_internal::currentIcon.visible = true;
  841.          }
  842.          return _loc3_;
  843.       }
  844.       
  845.       mx_internal function getCurrentButtonState() : String
  846.       {
  847.          this._currentButtonState = "";
  848.          if(!enabled)
  849.          {
  850.             this._currentButtonState = this.selected ? "selectedDisabled" : "disabled";
  851.          }
  852.          else if(this.mx_internal::phase == ButtonPhase.UP)
  853.          {
  854.             this._currentButtonState = this.selected ? "selectedUp" : "up";
  855.          }
  856.          else if(this.mx_internal::phase == ButtonPhase.OVER)
  857.          {
  858.             this._currentButtonState = this.selected ? "selectedOver" : "over";
  859.          }
  860.          else if(this.mx_internal::phase == ButtonPhase.DOWN)
  861.          {
  862.             this._currentButtonState = this.selected ? "selectedDown" : "down";
  863.          }
  864.          return this._currentButtonState;
  865.       }
  866.       
  867.       mx_internal function layoutContents(param1:Number, param2:Number, param3:Boolean) : void
  868.       {
  869.          var _loc20_:TextLineMetrics = null;
  870.          var _loc28_:MoveEvent = null;
  871.          var _loc4_:Number = 0;
  872.          var _loc5_:Number = 0;
  873.          var _loc6_:Number = 0;
  874.          var _loc7_:Number = 0;
  875.          var _loc8_:Number = 0;
  876.          var _loc9_:Number = 0;
  877.          var _loc10_:Number = 0;
  878.          var _loc11_:Number = 0;
  879.          var _loc12_:Number = 0;
  880.          var _loc13_:Number = 0;
  881.          var _loc14_:Number = getStyle("paddingLeft");
  882.          var _loc15_:Number = getStyle("paddingRight");
  883.          var _loc16_:Number = getStyle("paddingTop");
  884.          var _loc17_:Number = getStyle("paddingBottom");
  885.          var _loc18_:Number = 0;
  886.          var _loc19_:Number = 0;
  887.          if(this.label)
  888.          {
  889.             _loc20_ = measureText(this.label);
  890.             _loc18_ = _loc20_.width + mx_internal::TEXT_WIDTH_PADDING;
  891.             _loc19_ = _loc20_.height + UITextField.mx_internal::TEXT_HEIGHT_PADDING;
  892.          }
  893.          else
  894.          {
  895.             _loc20_ = measureText("Wj");
  896.             _loc19_ = _loc20_.height + UITextField.mx_internal::TEXT_HEIGHT_PADDING;
  897.          }
  898.          var _loc21_:Number = param3 ? this.mx_internal::buttonOffset : 0;
  899.          var _loc22_:String = getStyle("textAlign");
  900.          if(_loc22_ == "start")
  901.          {
  902.             _loc22_ = TextFormatAlign.LEFT;
  903.          }
  904.          else if(_loc22_ == "end")
  905.          {
  906.             _loc22_ = TextFormatAlign.RIGHT;
  907.          }
  908.          var _loc23_:Number = param1;
  909.          var _loc24_:Number = param2;
  910.          var _loc25_:EdgeMetrics = this.mx_internal::currentSkin && this.mx_internal::currentSkin is IBorder && !(this.mx_internal::currentSkin is IFlexAsset) ? IBorder(this.mx_internal::currentSkin).borderMetrics : null;
  911.          if(_loc25_)
  912.          {
  913.             _loc23_ -= _loc25_.left + _loc25_.right;
  914.             _loc24_ -= _loc25_.top + _loc25_.bottom;
  915.          }
  916.          if(this.mx_internal::currentIcon)
  917.          {
  918.             _loc8_ = Number(this.mx_internal::currentIcon.width);
  919.             _loc9_ = Number(this.mx_internal::currentIcon.height);
  920.          }
  921.          if(this.labelPlacement == ButtonLabelPlacement.LEFT || this.labelPlacement == ButtonLabelPlacement.RIGHT)
  922.          {
  923.             _loc12_ = getStyle("horizontalGap");
  924.             if(_loc8_ == 0 || _loc18_ == 0)
  925.             {
  926.                _loc12_ = 0;
  927.             }
  928.             if(_loc18_ > 0)
  929.             {
  930.                this.textField.width = _loc4_ = Math.max(Math.min(_loc23_ - _loc8_ - _loc12_ - _loc14_ - _loc15_,_loc18_),0);
  931.             }
  932.             else
  933.             {
  934.                this.textField.width = _loc4_ = 0;
  935.             }
  936.             this.textField.height = _loc5_ = Math.min(_loc24_,_loc19_);
  937.             if(_loc22_ == "left")
  938.             {
  939.                _loc6_ += _loc14_;
  940.             }
  941.             else if(_loc22_ == "right")
  942.             {
  943.                _loc6_ += _loc23_ - _loc4_ - _loc8_ - _loc12_ - _loc15_;
  944.             }
  945.             else
  946.             {
  947.                _loc6_ += (_loc23_ - _loc4_ - _loc8_ - _loc12_ - _loc14_ - _loc15_) / 2 + _loc14_;
  948.             }
  949.             if(this.labelPlacement == ButtonLabelPlacement.RIGHT)
  950.             {
  951.                _loc6_ += _loc8_ + _loc12_;
  952.                _loc10_ = _loc6_ - (_loc8_ + _loc12_);
  953.             }
  954.             else
  955.             {
  956.                _loc10_ = _loc6_ + _loc4_ + _loc12_;
  957.             }
  958.             _loc11_ = (_loc24_ - _loc9_ - _loc16_ - _loc17_) / 2 + _loc16_;
  959.             _loc7_ = (_loc24_ - _loc5_ - _loc16_ - _loc17_) / 2 + _loc16_;
  960.          }
  961.          else
  962.          {
  963.             _loc13_ = getStyle("verticalGap");
  964.             if(_loc9_ == 0 || this.label == "")
  965.             {
  966.                _loc13_ = 0;
  967.             }
  968.             if(_loc18_ > 0)
  969.             {
  970.                this.textField.width = _loc4_ = Math.max(_loc23_ - _loc14_ - _loc15_,0);
  971.                this.textField.height = _loc5_ = Math.min(_loc24_ - _loc9_ - _loc16_ - _loc17_ - _loc13_,_loc19_);
  972.             }
  973.             else
  974.             {
  975.                this.textField.width = _loc4_ = 0;
  976.                this.textField.height = _loc5_ = 0;
  977.             }
  978.             _loc6_ = _loc14_;
  979.             if(_loc22_ == "left")
  980.             {
  981.                _loc10_ += _loc14_;
  982.             }
  983.             else if(_loc22_ == "right")
  984.             {
  985.                _loc10_ += Math.max(_loc23_ - _loc8_ - _loc15_,_loc14_);
  986.             }
  987.             else
  988.             {
  989.                _loc10_ += (_loc23_ - _loc8_ - _loc14_ - _loc15_) / 2 + _loc14_;
  990.             }
  991.             if(this.labelPlacement == ButtonLabelPlacement.TOP)
  992.             {
  993.                _loc7_ += (_loc24_ - _loc5_ - _loc9_ - _loc16_ - _loc17_ - _loc13_) / 2 + _loc16_;
  994.                _loc11_ += _loc7_ + _loc5_ + _loc13_;
  995.             }
  996.             else
  997.             {
  998.                _loc11_ += (_loc24_ - _loc5_ - _loc9_ - _loc16_ - _loc17_ - _loc13_) / 2 + _loc16_;
  999.                _loc7_ += _loc11_ + _loc9_ + _loc13_;
  1000.             }
  1001.          }
  1002.          var _loc26_:Number = _loc21_;
  1003.          var _loc27_:Number = _loc21_;
  1004.          if(_loc25_)
  1005.          {
  1006.             _loc26_ += _loc25_.left;
  1007.             _loc27_ += _loc25_.top;
  1008.          }
  1009.          if(FlexVersion.compatibilityVersion >= FlexVersion.VERSION_4_0)
  1010.          {
  1011.             _loc7_ += getStyle("labelVerticalOffset");
  1012.          }
  1013.          this.textField.x = Math.round(_loc6_ + _loc26_);
  1014.          this.textField.y = Math.round(_loc7_ + _loc27_);
  1015.          if(this.mx_internal::currentIcon)
  1016.          {
  1017.             _loc10_ += _loc26_;
  1018.             _loc11_ += _loc27_;
  1019.             _loc28_ = new MoveEvent(MoveEvent.MOVE);
  1020.             _loc28_.oldX = this.mx_internal::currentIcon.x;
  1021.             _loc28_.oldY = this.mx_internal::currentIcon.y;
  1022.             this.mx_internal::currentIcon.x = Math.round(_loc10_);
  1023.             this.mx_internal::currentIcon.y = Math.round(_loc11_);
  1024.             this.mx_internal::currentIcon.dispatchEvent(_loc28_);
  1025.          }
  1026.          if(this.mx_internal::currentSkin)
  1027.          {
  1028.             setChildIndex(DisplayObject(this.mx_internal::currentSkin),numChildren - 1);
  1029.          }
  1030.          if(this.mx_internal::currentIcon)
  1031.          {
  1032.             setChildIndex(DisplayObject(this.mx_internal::currentIcon),numChildren - 1);
  1033.          }
  1034.          if(this.textField)
  1035.          {
  1036.             setChildIndex(DisplayObject(this.textField),numChildren - 1);
  1037.          }
  1038.       }
  1039.       
  1040.       mx_internal function changeSkins() : void
  1041.       {
  1042.          var _loc1_:int = int(this.skins.length);
  1043.          var _loc2_:int = 0;
  1044.          while(_loc2_ < _loc1_)
  1045.          {
  1046.             removeChild(this.skins[_loc2_]);
  1047.             _loc2_++;
  1048.          }
  1049.          this.skins = [];
  1050.          this.skinMeasuredWidth = NaN;
  1051.          this.skinMeasuredHeight = NaN;
  1052.          this.mx_internal::checkedDefaultSkin = false;
  1053.          this.mx_internal::defaultSkinUsesStates = false;
  1054.          if(initialized)
  1055.          {
  1056.             this.mx_internal::viewSkin();
  1057.             invalidateSize();
  1058.          }
  1059.       }
  1060.       
  1061.       mx_internal function changeIcons() : void
  1062.       {
  1063.          var _loc1_:int = int(this.icons.length);
  1064.          var _loc2_:int = 0;
  1065.          while(_loc2_ < _loc1_)
  1066.          {
  1067.             removeChild(this.icons[_loc2_]);
  1068.             _loc2_++;
  1069.          }
  1070.          this.icons = [];
  1071.          this.mx_internal::checkedDefaultIcon = false;
  1072.          this.mx_internal::defaultIconUsesStates = false;
  1073.       }
  1074.       
  1075.       mx_internal function buttonPressed() : void
  1076.       {
  1077.          this.mx_internal::phase = ButtonPhase.DOWN;
  1078.          dispatchEvent(new FlexEvent(FlexEvent.BUTTON_DOWN));
  1079.          if(this.autoRepeat)
  1080.          {
  1081.             this.autoRepeatTimer.delay = getStyle("repeatDelay");
  1082.             this.autoRepeatTimer.addEventListener(TimerEvent.TIMER,this.autoRepeatTimer_timerDelayHandler);
  1083.             this.autoRepeatTimer.start();
  1084.          }
  1085.       }
  1086.       
  1087.       mx_internal function buttonReleased() : void
  1088.       {
  1089.          systemManager.getSandboxRoot().removeEventListener(MouseEvent.MOUSE_UP,this.systemManager_mouseUpHandler,true);
  1090.          systemManager.getSandboxRoot().removeEventListener(SandboxMouseEvent.MOUSE_UP_SOMEWHERE,this.stage_mouseLeaveHandler);
  1091.          if(this.autoRepeatTimer)
  1092.          {
  1093.             this.autoRepeatTimer.removeEventListener(TimerEvent.TIMER,this.autoRepeatTimer_timerDelayHandler);
  1094.             this.autoRepeatTimer.removeEventListener(TimerEvent.TIMER,this.autoRepeatTimer_timerHandler);
  1095.             this.autoRepeatTimer.reset();
  1096.          }
  1097.       }
  1098.       
  1099.       mx_internal function getTextField() : IUITextField
  1100.       {
  1101.          return this.textField;
  1102.       }
  1103.       
  1104.       override protected function focusOutHandler(param1:FocusEvent) : void
  1105.       {
  1106.          super.focusOutHandler(param1);
  1107.          if(this.mx_internal::phase != ButtonPhase.UP)
  1108.          {
  1109.             this.mx_internal::phase = ButtonPhase.UP;
  1110.          }
  1111.       }
  1112.       
  1113.       override protected function keyDownHandler(param1:KeyboardEvent) : void
  1114.       {
  1115.          if(!enabled)
  1116.          {
  1117.             return;
  1118.          }
  1119.          if(param1.keyCode == Keyboard.SPACE)
  1120.          {
  1121.             this.mx_internal::buttonPressed();
  1122.          }
  1123.       }
  1124.       
  1125.       override protected function keyUpHandler(param1:KeyboardEvent) : void
  1126.       {
  1127.          if(!enabled)
  1128.          {
  1129.             return;
  1130.          }
  1131.          if(param1.keyCode == Keyboard.SPACE)
  1132.          {
  1133.             this.mx_internal::buttonReleased();
  1134.             if(this.mx_internal::phase == ButtonPhase.DOWN)
  1135.             {
  1136.                dispatchEvent(new MouseEvent(MouseEvent.CLICK));
  1137.             }
  1138.             this.mx_internal::phase = ButtonPhase.UP;
  1139.          }
  1140.       }
  1141.       
  1142.       protected function rollOverHandler(param1:MouseEvent) : void
  1143.       {
  1144.          if(this.mx_internal::phase == ButtonPhase.UP)
  1145.          {
  1146.             if(param1.buttonDown)
  1147.             {
  1148.                return;
  1149.             }
  1150.             this.mx_internal::phase = ButtonPhase.OVER;
  1151.             param1.updateAfterEvent();
  1152.          }
  1153.          else if(this.mx_internal::phase == ButtonPhase.OVER)
  1154.          {
  1155.             this.mx_internal::phase = ButtonPhase.DOWN;
  1156.             param1.updateAfterEvent();
  1157.             if(this.autoRepeatTimer)
  1158.             {
  1159.                this.autoRepeatTimer.start();
  1160.             }
  1161.          }
  1162.       }
  1163.       
  1164.       protected function rollOutHandler(param1:MouseEvent) : void
  1165.       {
  1166.          if(this.mx_internal::phase == ButtonPhase.OVER)
  1167.          {
  1168.             this.mx_internal::phase = ButtonPhase.UP;
  1169.             param1.updateAfterEvent();
  1170.          }
  1171.          else if(this.mx_internal::phase == ButtonPhase.DOWN && !this.stickyHighlighting)
  1172.          {
  1173.             this.mx_internal::phase = ButtonPhase.OVER;
  1174.             param1.updateAfterEvent();
  1175.             if(this.autoRepeatTimer)
  1176.             {
  1177.                this.autoRepeatTimer.stop();
  1178.             }
  1179.          }
  1180.       }
  1181.       
  1182.       protected function mouseDownHandler(param1:MouseEvent) : void
  1183.       {
  1184.          if(!enabled)
  1185.          {
  1186.             return;
  1187.          }
  1188.          systemManager.getSandboxRoot().addEventListener(MouseEvent.MOUSE_UP,this.systemManager_mouseUpHandler,true);
  1189.          systemManager.getSandboxRoot().addEventListener(SandboxMouseEvent.MOUSE_UP_SOMEWHERE,this.stage_mouseLeaveHandler);
  1190.          this.mx_internal::buttonPressed();
  1191.          param1.updateAfterEvent();
  1192.       }
  1193.       
  1194.       protected function mouseUpHandler(param1:MouseEvent) : void
  1195.       {
  1196.          if(!enabled)
  1197.          {
  1198.             return;
  1199.          }
  1200.          this.mx_internal::phase = ButtonPhase.OVER;
  1201.          this.mx_internal::buttonReleased();
  1202.          if(!this.toggle)
  1203.          {
  1204.             param1.updateAfterEvent();
  1205.          }
  1206.       }
  1207.       
  1208.       protected function clickHandler(param1:MouseEvent) : void
  1209.       {
  1210.          if(!enabled)
  1211.          {
  1212.             param1.stopImmediatePropagation();
  1213.             return;
  1214.          }
  1215.          if(this.toggle)
  1216.          {
  1217.             this.mx_internal::setSelected(!this.selected);
  1218.             param1.updateAfterEvent();
  1219.          }
  1220.       }
  1221.       
  1222.       private function systemManager_mouseUpHandler(param1:MouseEvent) : void
  1223.       {
  1224.          if(contains(DisplayObject(param1.target)))
  1225.          {
  1226.             return;
  1227.          }
  1228.          this.mx_internal::phase = ButtonPhase.UP;
  1229.          this.mx_internal::buttonReleased();
  1230.          param1.updateAfterEvent();
  1231.       }
  1232.       
  1233.       private function stage_mouseLeaveHandler(param1:Event) : void
  1234.       {
  1235.          this.mx_internal::phase = ButtonPhase.UP;
  1236.          this.mx_internal::buttonReleased();
  1237.       }
  1238.       
  1239.       private function autoRepeatTimer_timerDelayHandler(param1:Event) : void
  1240.       {
  1241.          if(!enabled)
  1242.          {
  1243.             return;
  1244.          }
  1245.          dispatchEvent(new FlexEvent(FlexEvent.BUTTON_DOWN));
  1246.          if(this.autoRepeat)
  1247.          {
  1248.             this.autoRepeatTimer.reset();
  1249.             this.autoRepeatTimer.removeEventListener(TimerEvent.TIMER,this.autoRepeatTimer_timerDelayHandler);
  1250.             this.autoRepeatTimer.delay = getStyle("repeatInterval");
  1251.             this.autoRepeatTimer.addEventListener(TimerEvent.TIMER,this.autoRepeatTimer_timerHandler);
  1252.             this.autoRepeatTimer.start();
  1253.          }
  1254.       }
  1255.       
  1256.       private function autoRepeatTimer_timerHandler(param1:Event) : void
  1257.       {
  1258.          if(!enabled)
  1259.          {
  1260.             return;
  1261.          }
  1262.          dispatchEvent(new FlexEvent(FlexEvent.BUTTON_DOWN));
  1263.       }
  1264.    }
  1265. }
  1266.  
  1267.