home *** CD-ROM | disk | FTP | other *** search
/ Computer Active 2010 August / CA08.iso / Multimedija / shufflr.air / ShufflrClient.swf / scripts / mx / controls / ComboBase.as < prev    next >
Encoding:
Text File  |  2010-06-23  |  25.4 KB  |  761 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 mx.collections.ArrayCollection;
  9.    import mx.collections.CursorBookmark;
  10.    import mx.collections.ICollectionView;
  11.    import mx.collections.IList;
  12.    import mx.collections.IViewCursor;
  13.    import mx.collections.ListCollectionView;
  14.    import mx.collections.XMLListCollection;
  15.    import mx.core.EdgeMetrics;
  16.    import mx.core.FlexVersion;
  17.    import mx.core.IFlexDisplayObject;
  18.    import mx.core.IIMESupport;
  19.    import mx.core.IRectangularBorder;
  20.    import mx.core.UIComponent;
  21.    import mx.core.UITextField;
  22.    import mx.core.mx_internal;
  23.    import mx.events.CollectionEvent;
  24.    import mx.events.CollectionEventKind;
  25.    import mx.events.FlexEvent;
  26.    import mx.managers.IFocusManager;
  27.    import mx.managers.IFocusManagerComponent;
  28.    import mx.styles.ISimpleStyleClient;
  29.    import mx.styles.StyleProxy;
  30.    import mx.utils.UIDUtil;
  31.    
  32.    use namespace mx_internal;
  33.    
  34.    public class ComboBase extends UIComponent implements IIMESupport, IFocusManagerComponent
  35.    {
  36.       mx_internal static var createAccessibilityImplementation:Function;
  37.       
  38.       mx_internal static const VERSION:String = "3.5.0.12683";
  39.       
  40.       private static var _textInputStyleFilters:Object = {
  41.          "backgroundAlpha":"backgroundAlpha",
  42.          "backgroundColor":"backgroundColor",
  43.          "backgroundImage":"backgroundImage",
  44.          "backgroundDisabledColor":"backgroundDisabledColor",
  45.          "backgroundSize":"backgroundSize",
  46.          "borderAlpha":"borderAlpha",
  47.          "borderColor":"borderColor",
  48.          "borderSides":"borderSides",
  49.          "borderSkin":"borderSkin",
  50.          "borderStyle":"borderStyle",
  51.          "borderThickness":"borderThickness",
  52.          "dropShadowColor":"dropShadowColor",
  53.          "dropShadowEnabled":"dropShadowEnabled",
  54.          "embedFonts":"embedFonts",
  55.          "focusAlpha":"focusAlpha",
  56.          "focusBlendMode":"focusBlendMode",
  57.          "focusRoundedCorners":"focusRoundedCorners",
  58.          "focusThickness":"focusThickness",
  59.          "leading":"leading",
  60.          "paddingLeft":"paddingLeft",
  61.          "paddingRight":"paddingRight",
  62.          "shadowDirection":"shadowDirection",
  63.          "shadowDistance":"shadowDistance",
  64.          "textDecoration":"textDecoration"
  65.       };
  66.       
  67.       private var _enabled:Boolean = false;
  68.       
  69.       mx_internal var useFullDropdownSkin:Boolean = false;
  70.       
  71.       mx_internal var selectedItemChanged:Boolean = false;
  72.       
  73.       mx_internal var selectionChanged:Boolean = false;
  74.       
  75.       mx_internal var downArrowButton:Button;
  76.       
  77.       private var _restrict:String;
  78.       
  79.       protected var collection:ICollectionView;
  80.       
  81.       private var _text:String = "";
  82.       
  83.       mx_internal var border:IFlexDisplayObject;
  84.       
  85.       private var _selectedItem:Object;
  86.       
  87.       mx_internal var editableChanged:Boolean = true;
  88.       
  89.       private var enabledChanged:Boolean = false;
  90.       
  91.       private var selectedUID:String;
  92.       
  93.       mx_internal var selectedIndexChanged:Boolean = false;
  94.       
  95.       mx_internal var oldBorderStyle:String;
  96.       
  97.       protected var textInput:TextInput;
  98.       
  99.       private var _editable:Boolean = false;
  100.       
  101.       mx_internal var collectionIterator:IViewCursor;
  102.       
  103.       mx_internal var textChanged:Boolean;
  104.       
  105.       private var _imeMode:String = null;
  106.       
  107.       protected var iterator:IViewCursor;
  108.       
  109.       mx_internal var wrapDownArrowButton:Boolean = true;
  110.       
  111.       private var _selectedIndex:int = -1;
  112.       
  113.       public function ComboBase()
  114.       {
  115.          super();
  116.          tabEnabled = true;
  117.       }
  118.       
  119.       protected function collectionChangeHandler(param1:Event) : void
  120.       {
  121.          var _loc2_:Boolean = false;
  122.          var _loc3_:Number = NaN;
  123.          var _loc4_:Object = null;
  124.          var _loc5_:CollectionEvent = null;
  125.          var _loc6_:int = 0;
  126.          var _loc7_:String = null;
  127.          if(param1 is CollectionEvent)
  128.          {
  129.             _loc2_ = false;
  130.             _loc5_ = CollectionEvent(param1);
  131.             if(_loc5_.kind == CollectionEventKind.ADD)
  132.             {
  133.                if(selectedIndex >= _loc5_.location)
  134.                {
  135.                   ++_selectedIndex;
  136.                }
  137.             }
  138.             if(_loc5_.kind == CollectionEventKind.REMOVE)
  139.             {
  140.                _loc6_ = 0;
  141.                while(_loc6_ < _loc5_.items.length)
  142.                {
  143.                   _loc7_ = itemToUID(_loc5_.items[_loc6_]);
  144.                   if(selectedUID == _loc7_)
  145.                   {
  146.                      mx_internal::selectionChanged = true;
  147.                   }
  148.                   _loc6_++;
  149.                }
  150.                if(mx_internal::selectionChanged)
  151.                {
  152.                   if(_selectedIndex >= collection.length)
  153.                   {
  154.                      _selectedIndex = collection.length - 1;
  155.                   }
  156.                   mx_internal::selectedIndexChanged = true;
  157.                   _loc2_ = true;
  158.                   invalidateDisplayList();
  159.                }
  160.                else if(selectedIndex >= _loc5_.location)
  161.                {
  162.                   --_selectedIndex;
  163.                   mx_internal::selectedIndexChanged = true;
  164.                   _loc2_ = true;
  165.                   invalidateDisplayList();
  166.                }
  167.             }
  168.             if(_loc5_.kind == CollectionEventKind.REFRESH)
  169.             {
  170.                mx_internal::selectedItemChanged = true;
  171.                _loc2_ = true;
  172.             }
  173.             invalidateDisplayList();
  174.             if(_loc2_)
  175.             {
  176.                dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  177.             }
  178.          }
  179.       }
  180.       
  181.       override public function set enabled(param1:Boolean) : void
  182.       {
  183.          super.enabled = param1;
  184.          _enabled = param1;
  185.          enabledChanged = true;
  186.          invalidateProperties();
  187.       }
  188.       
  189.       public function get imeMode() : String
  190.       {
  191.          return _imeMode;
  192.       }
  193.       
  194.       override protected function focusOutHandler(param1:FocusEvent) : void
  195.       {
  196.          super.focusOutHandler(param1);
  197.          var _loc2_:IFocusManager = focusManager;
  198.          if(_loc2_)
  199.          {
  200.             _loc2_.defaultButtonEnabled = true;
  201.          }
  202.          if(_editable)
  203.          {
  204.             dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  205.          }
  206.       }
  207.       
  208.       override public function get baselinePosition() : Number
  209.       {
  210.          if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  211.          {
  212.             return textInput.y + textInput.baselinePosition;
  213.          }
  214.          if(!mx_internal::validateBaselinePosition())
  215.          {
  216.             return NaN;
  217.          }
  218.          return textInput.y + textInput.baselinePosition;
  219.       }
  220.       
  221.       public function set imeMode(param1:String) : void
  222.       {
  223.          _imeMode = param1;
  224.          if(textInput)
  225.          {
  226.             textInput.imeMode = _imeMode;
  227.          }
  228.       }
  229.       
  230.       protected function itemToUID(param1:Object) : String
  231.       {
  232.          if(!param1)
  233.          {
  234.             return "null";
  235.          }
  236.          return UIDUtil.getUID(param1);
  237.       }
  238.       
  239.       protected function downArrowButton_buttonDownHandler(param1:FlexEvent) : void
  240.       {
  241.       }
  242.       
  243.       override protected function createChildren() : void
  244.       {
  245.          var _loc1_:Class = null;
  246.          var _loc2_:Object = null;
  247.          super.createChildren();
  248.          if(!mx_internal::border)
  249.          {
  250.             _loc1_ = getStyle("borderSkin");
  251.             if(_loc1_)
  252.             {
  253.                mx_internal::border = new _loc1_();
  254.                if(mx_internal::border is IFocusManagerComponent)
  255.                {
  256.                   IFocusManagerComponent(mx_internal::border).focusEnabled = false;
  257.                }
  258.                if(mx_internal::border is ISimpleStyleClient)
  259.                {
  260.                   ISimpleStyleClient(mx_internal::border).styleName = this;
  261.                }
  262.                addChild(DisplayObject(mx_internal::border));
  263.             }
  264.          }
  265.          if(!mx_internal::downArrowButton)
  266.          {
  267.             mx_internal::downArrowButton = new Button();
  268.             mx_internal::downArrowButton.styleName = new StyleProxy(this,arrowButtonStyleFilters);
  269.             mx_internal::downArrowButton.focusEnabled = false;
  270.             addChild(mx_internal::downArrowButton);
  271.             mx_internal::downArrowButton.addEventListener(FlexEvent.BUTTON_DOWN,downArrowButton_buttonDownHandler);
  272.          }
  273.          if(!textInput)
  274.          {
  275.             _loc2_ = getStyle("textInputStyleName");
  276.             if(!_loc2_)
  277.             {
  278.                _loc2_ = new StyleProxy(this,textInputStyleFilters);
  279.             }
  280.             textInput = new TextInput();
  281.             textInput.editable = _editable;
  282.             mx_internal::editableChanged = true;
  283.             textInput.restrict = "^\x1b";
  284.             textInput.focusEnabled = false;
  285.             textInput.imeMode = _imeMode;
  286.             textInput.styleName = _loc2_;
  287.             textInput.addEventListener(Event.CHANGE,textInput_changeHandler);
  288.             textInput.addEventListener(FlexEvent.ENTER,textInput_enterHandler);
  289.             textInput.addEventListener(FocusEvent.FOCUS_IN,focusInHandler);
  290.             textInput.addEventListener(FocusEvent.FOCUS_OUT,focusOutHandler);
  291.             textInput.addEventListener(FlexEvent.VALUE_COMMIT,textInput_valueCommitHandler);
  292.             addChild(textInput);
  293.             textInput.move(0,0);
  294.             textInput.mx_internal::parentDrawsFocus = true;
  295.          }
  296.       }
  297.       
  298.       public function set selectedItem(param1:Object) : void
  299.       {
  300.          setSelectedItem(param1);
  301.       }
  302.       
  303.       override protected function initializeAccessibility() : void
  304.       {
  305.          if(ComboBase.mx_internal::createAccessibilityImplementation != null)
  306.          {
  307.             ComboBase.mx_internal::createAccessibilityImplementation(this);
  308.          }
  309.       }
  310.       
  311.       private function textInput_enterHandler(param1:FlexEvent) : void
  312.       {
  313.          dispatchEvent(param1);
  314.          dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  315.       }
  316.       
  317.       protected function calculatePreferredSizeFromData(param1:int) : Object
  318.       {
  319.          return null;
  320.       }
  321.       
  322.       override public function setFocus() : void
  323.       {
  324.          if(Boolean(textInput) && _editable)
  325.          {
  326.             textInput.setFocus();
  327.          }
  328.          else
  329.          {
  330.             super.setFocus();
  331.          }
  332.       }
  333.       
  334.       private function textInput_valueCommitHandler(param1:FlexEvent) : void
  335.       {
  336.          _text = textInput.text;
  337.          dispatchEvent(param1);
  338.       }
  339.       
  340.       [NonCommittingChangeEvent("change")]
  341.       [Bindable("valueCommit")]
  342.       [Bindable("collectionChange")]
  343.       public function get text() : String
  344.       {
  345.          return _text;
  346.       }
  347.       
  348.       [Bindable("collectionChange")]
  349.       public function get dataProvider() : Object
  350.       {
  351.          return collection;
  352.       }
  353.       
  354.       protected function get arrowButtonStyleFilters() : Object
  355.       {
  356.          return null;
  357.       }
  358.       
  359.       public function set editable(param1:Boolean) : void
  360.       {
  361.          _editable = param1;
  362.          mx_internal::editableChanged = true;
  363.          invalidateProperties();
  364.          dispatchEvent(new Event("editableChanged"));
  365.       }
  366.       
  367.       override public function styleChanged(param1:String) : void
  368.       {
  369.          if(mx_internal::downArrowButton)
  370.          {
  371.             mx_internal::downArrowButton.styleChanged(param1);
  372.          }
  373.          if(textInput)
  374.          {
  375.             textInput.styleChanged(param1);
  376.          }
  377.          if(Boolean(mx_internal::border) && mx_internal::border is ISimpleStyleClient)
  378.          {
  379.             ISimpleStyleClient(mx_internal::border).styleChanged(param1);
  380.          }
  381.          super.styleChanged(param1);
  382.       }
  383.       
  384.       [Bindable("restrictChanged")]
  385.       public function get restrict() : String
  386.       {
  387.          return _restrict;
  388.       }
  389.       
  390.       [Bindable("valueCommit")]
  391.       [Bindable("change")]
  392.       public function get selectedItem() : Object
  393.       {
  394.          return _selectedItem;
  395.       }
  396.       
  397.       mx_internal function get ComboDownArrowButton() : Button
  398.       {
  399.          return mx_internal::downArrowButton;
  400.       }
  401.       
  402.       private function setSelectedItem(param1:Object, param2:Boolean = true) : void
  403.       {
  404.          if(!collection || collection.length == 0)
  405.          {
  406.             _selectedItem = param1;
  407.             mx_internal::selectedItemChanged = true;
  408.             invalidateDisplayList();
  409.             return;
  410.          }
  411.          var _loc3_:Boolean = false;
  412.          var _loc4_:IViewCursor = collection.createCursor();
  413.          var _loc5_:int = 0;
  414.          do
  415.          {
  416.             if(param1 == _loc4_.current)
  417.             {
  418.                _selectedIndex = _loc5_;
  419.                _selectedItem = param1;
  420.                selectedUID = itemToUID(param1);
  421.                mx_internal::selectionChanged = true;
  422.                _loc3_ = true;
  423.                break;
  424.             }
  425.             _loc5_++;
  426.          }
  427.          while(_loc4_.moveNext());
  428.          
  429.          if(!_loc3_)
  430.          {
  431.             selectedIndex = -1;
  432.             _selectedItem = null;
  433.             selectedUID = null;
  434.          }
  435.          invalidateDisplayList();
  436.       }
  437.       
  438.       override protected function commitProperties() : void
  439.       {
  440.          var _loc1_:Boolean = false;
  441.          super.commitProperties();
  442.          textInput.restrict = _restrict;
  443.          if(mx_internal::textChanged)
  444.          {
  445.             textInput.text = _text;
  446.             mx_internal::textChanged = false;
  447.          }
  448.          if(enabledChanged)
  449.          {
  450.             textInput.enabled = _enabled;
  451.             mx_internal::editableChanged = true;
  452.             mx_internal::downArrowButton.enabled = _enabled;
  453.             enabledChanged = false;
  454.          }
  455.          if(mx_internal::editableChanged)
  456.          {
  457.             mx_internal::editableChanged = false;
  458.             _loc1_ = _editable;
  459.             if(mx_internal::wrapDownArrowButton == false)
  460.             {
  461.                if(_loc1_)
  462.                {
  463.                   if(mx_internal::oldBorderStyle)
  464.                   {
  465.                      setStyle("borderStyle",mx_internal::oldBorderStyle);
  466.                   }
  467.                }
  468.                else
  469.                {
  470.                   mx_internal::oldBorderStyle = getStyle("borderStyle");
  471.                   setStyle("borderStyle","comboNonEdit");
  472.                }
  473.             }
  474.             if(mx_internal::useFullDropdownSkin)
  475.             {
  476.                mx_internal::downArrowButton.mx_internal::upSkinName = _loc1_ ? "editableUpSkin" : "upSkin";
  477.                mx_internal::downArrowButton.mx_internal::overSkinName = _loc1_ ? "editableOverSkin" : "overSkin";
  478.                mx_internal::downArrowButton.mx_internal::downSkinName = _loc1_ ? "editableDownSkin" : "downSkin";
  479.                mx_internal::downArrowButton.mx_internal::disabledSkinName = _loc1_ ? "editableDisabledSkin" : "disabledSkin";
  480.                mx_internal::downArrowButton.mx_internal::changeSkins();
  481.                mx_internal::downArrowButton.invalidateDisplayList();
  482.             }
  483.             if(textInput)
  484.             {
  485.                textInput.editable = _loc1_;
  486.                textInput.mx_internal::selectable = _loc1_;
  487.                if(_loc1_)
  488.                {
  489.                   textInput.removeEventListener(MouseEvent.MOUSE_DOWN,textInput_mouseEventHandler);
  490.                   textInput.removeEventListener(MouseEvent.MOUSE_UP,textInput_mouseEventHandler);
  491.                   textInput.removeEventListener(MouseEvent.ROLL_OVER,textInput_mouseEventHandler);
  492.                   textInput.removeEventListener(MouseEvent.ROLL_OUT,textInput_mouseEventHandler);
  493.                   textInput.addEventListener(KeyboardEvent.KEY_DOWN,keyDownHandler);
  494.                }
  495.                else
  496.                {
  497.                   textInput.addEventListener(MouseEvent.MOUSE_DOWN,textInput_mouseEventHandler);
  498.                   textInput.addEventListener(MouseEvent.MOUSE_UP,textInput_mouseEventHandler);
  499.                   textInput.addEventListener(MouseEvent.ROLL_OVER,textInput_mouseEventHandler);
  500.                   textInput.addEventListener(MouseEvent.ROLL_OUT,textInput_mouseEventHandler);
  501.                   textInput.removeEventListener(KeyboardEvent.KEY_DOWN,keyDownHandler);
  502.                }
  503.             }
  504.          }
  505.       }
  506.       
  507.       protected function get textInputStyleFilters() : Object
  508.       {
  509.          return _textInputStyleFilters;
  510.       }
  511.       
  512.       public function set text(param1:String) : void
  513.       {
  514.          _text = param1;
  515.          mx_internal::textChanged = true;
  516.          invalidateProperties();
  517.          dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  518.       }
  519.       
  520.       override protected function isOurFocus(param1:DisplayObject) : Boolean
  521.       {
  522.          return param1 == textInput || super.isOurFocus(param1);
  523.       }
  524.       
  525.       [Bindable("editableChanged")]
  526.       public function get editable() : Boolean
  527.       {
  528.          return _editable;
  529.       }
  530.       
  531.       override protected function measure() : void
  532.       {
  533.          var _loc2_:Number = NaN;
  534.          var _loc3_:Object = null;
  535.          var _loc4_:EdgeMetrics = null;
  536.          var _loc5_:Number = NaN;
  537.          var _loc6_:Number = NaN;
  538.          var _loc7_:Number = NaN;
  539.          super.measure();
  540.          var _loc1_:Number = getStyle("arrowButtonWidth");
  541.          _loc2_ = mx_internal::downArrowButton.getExplicitOrMeasuredHeight();
  542.          if(Boolean(collection) && collection.length > 0)
  543.          {
  544.             _loc3_ = calculatePreferredSizeFromData(collection.length);
  545.             _loc4_ = borderMetrics;
  546.             _loc5_ = _loc3_.width + _loc4_.left + _loc4_.right + 8;
  547.             _loc6_ = _loc3_.height + _loc4_.top + _loc4_.bottom + UITextField.mx_internal::TEXT_HEIGHT_PADDING;
  548.             measuredMinWidth = measuredWidth = _loc5_ + _loc1_;
  549.             measuredMinHeight = measuredHeight = Math.max(_loc6_,_loc2_);
  550.          }
  551.          else
  552.          {
  553.             measuredMinWidth = DEFAULT_MEASURED_MIN_WIDTH;
  554.             measuredWidth = DEFAULT_MEASURED_WIDTH;
  555.             measuredMinHeight = DEFAULT_MEASURED_MIN_HEIGHT;
  556.             measuredHeight = DEFAULT_MEASURED_HEIGHT;
  557.          }
  558.          if(FlexVersion.compatibilityVersion >= FlexVersion.VERSION_3_0)
  559.          {
  560.             _loc7_ = getStyle("paddingTop") + getStyle("paddingBottom");
  561.             measuredMinHeight += _loc7_;
  562.             measuredHeight += _loc7_;
  563.          }
  564.       }
  565.       
  566.       protected function textInput_changeHandler(param1:Event) : void
  567.       {
  568.          _text = textInput.text;
  569.          if(_selectedIndex != -1)
  570.          {
  571.             _selectedIndex = -1;
  572.             _selectedItem = null;
  573.             selectedUID = null;
  574.          }
  575.       }
  576.       
  577.       mx_internal function getTextInput() : TextInput
  578.       {
  579.          return textInput;
  580.       }
  581.       
  582.       override protected function focusInHandler(param1:FocusEvent) : void
  583.       {
  584.          super.focusInHandler(param1);
  585.       }
  586.       
  587.       [Bindable("valueCommit")]
  588.       [Bindable("change")]
  589.       public function get value() : Object
  590.       {
  591.          if(_editable)
  592.          {
  593.             return text;
  594.          }
  595.          var _loc1_:Object = selectedItem;
  596.          if(_loc1_ == null || typeof _loc1_ != "object")
  597.          {
  598.             return _loc1_;
  599.          }
  600.          return _loc1_.data != null ? _loc1_.data : _loc1_.label;
  601.       }
  602.       
  603.       private function textInput_mouseEventHandler(param1:Event) : void
  604.       {
  605.          mx_internal::downArrowButton.dispatchEvent(param1);
  606.       }
  607.       
  608.       public function set selectedIndex(param1:int) : void
  609.       {
  610.          var _loc2_:CursorBookmark = null;
  611.          var _loc3_:int = 0;
  612.          var _loc4_:Object = null;
  613.          var _loc5_:String = null;
  614.          _selectedIndex = param1;
  615.          if(param1 == -1)
  616.          {
  617.             _selectedItem = null;
  618.             selectedUID = null;
  619.          }
  620.          if(!collection || collection.length == 0)
  621.          {
  622.             mx_internal::selectedIndexChanged = true;
  623.          }
  624.          else if(param1 != -1)
  625.          {
  626.             param1 = Math.min(param1,collection.length - 1);
  627.             _loc2_ = iterator.bookmark;
  628.             _loc3_ = param1;
  629.             iterator.seek(CursorBookmark.FIRST,_loc3_);
  630.             _loc4_ = iterator.current;
  631.             _loc5_ = itemToUID(_loc4_);
  632.             iterator.seek(_loc2_,0);
  633.             _selectedIndex = param1;
  634.             _selectedItem = _loc4_;
  635.             selectedUID = _loc5_;
  636.          }
  637.          mx_internal::selectionChanged = true;
  638.          invalidateDisplayList();
  639.          dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  640.       }
  641.       
  642.       public function set dataProvider(param1:Object) : void
  643.       {
  644.          var _loc3_:Array = null;
  645.          if(param1 is Array)
  646.          {
  647.             collection = new ArrayCollection(param1 as Array);
  648.          }
  649.          else if(param1 is ICollectionView)
  650.          {
  651.             collection = ICollectionView(param1);
  652.          }
  653.          else if(param1 is IList)
  654.          {
  655.             collection = new ListCollectionView(IList(param1));
  656.          }
  657.          else if(param1 is XMLList)
  658.          {
  659.             collection = new XMLListCollection(param1 as XMLList);
  660.          }
  661.          else
  662.          {
  663.             _loc3_ = [param1];
  664.             collection = new ArrayCollection(_loc3_);
  665.          }
  666.          iterator = collection.createCursor();
  667.          mx_internal::collectionIterator = collection.createCursor();
  668.          collection.addEventListener(CollectionEvent.COLLECTION_CHANGE,collectionChangeHandler,false,0,true);
  669.          var _loc2_:CollectionEvent = new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
  670.          _loc2_.kind = CollectionEventKind.RESET;
  671.          collectionChangeHandler(_loc2_);
  672.          dispatchEvent(_loc2_);
  673.          invalidateSize();
  674.          invalidateDisplayList();
  675.       }
  676.       
  677.       protected function get borderMetrics() : EdgeMetrics
  678.       {
  679.          if(Boolean(mx_internal::border) && mx_internal::border is IRectangularBorder)
  680.          {
  681.             return IRectangularBorder(mx_internal::border).borderMetrics;
  682.          }
  683.          return EdgeMetrics.EMPTY;
  684.       }
  685.       
  686.       public function set restrict(param1:String) : void
  687.       {
  688.          _restrict = param1;
  689.          invalidateProperties();
  690.          dispatchEvent(new Event("restrictChanged"));
  691.       }
  692.       
  693.       override protected function updateDisplayList(param1:Number, param2:Number) : void
  694.       {
  695.          var _loc7_:EdgeMetrics = null;
  696.          var _loc8_:Number = NaN;
  697.          var _loc9_:Number = NaN;
  698.          var _loc10_:Number = NaN;
  699.          super.updateDisplayList(param1,param2);
  700.          var _loc3_:Number = param1;
  701.          var _loc4_:Number = param2;
  702.          var _loc5_:Number = getStyle("arrowButtonWidth");
  703.          var _loc6_:Number = textInput.getExplicitOrMeasuredHeight();
  704.          if(isNaN(_loc5_))
  705.          {
  706.             _loc5_ = 0;
  707.          }
  708.          if(mx_internal::wrapDownArrowButton)
  709.          {
  710.             _loc7_ = borderMetrics;
  711.             _loc8_ = _loc4_ - _loc7_.top - _loc7_.bottom;
  712.             mx_internal::downArrowButton.setActualSize(_loc8_,_loc8_);
  713.             mx_internal::downArrowButton.move(_loc3_ - _loc5_ - _loc7_.right,_loc7_.top);
  714.             mx_internal::border.setActualSize(_loc3_,_loc4_);
  715.             textInput.setActualSize(_loc3_ - _loc5_,_loc6_);
  716.          }
  717.          else if(!_editable && mx_internal::useFullDropdownSkin)
  718.          {
  719.             _loc9_ = getStyle("paddingTop");
  720.             _loc10_ = getStyle("paddingBottom");
  721.             mx_internal::downArrowButton.move(0,0);
  722.             mx_internal::border.setActualSize(_loc3_,_loc4_);
  723.             textInput.setActualSize(_loc3_ - _loc5_,_loc6_);
  724.             textInput.mx_internal::border.visible = false;
  725.             if(FlexVersion.compatibilityVersion >= FlexVersion.VERSION_3_0)
  726.             {
  727.                textInput.move(textInput.x,(_loc4_ - _loc6_ - _loc9_ - _loc10_) / 2 + _loc9_);
  728.             }
  729.             mx_internal::downArrowButton.setActualSize(param1,param2);
  730.          }
  731.          else
  732.          {
  733.             mx_internal::downArrowButton.move(_loc3_ - _loc5_,0);
  734.             mx_internal::border.setActualSize(_loc3_ - _loc5_,_loc4_);
  735.             textInput.setActualSize(_loc3_ - _loc5_,_loc4_);
  736.             mx_internal::downArrowButton.setActualSize(_loc5_,param2);
  737.             textInput.mx_internal::border.visible = true;
  738.          }
  739.          if(mx_internal::selectedItemChanged)
  740.          {
  741.             selectedItem = selectedItem;
  742.             mx_internal::selectedItemChanged = false;
  743.             mx_internal::selectedIndexChanged = false;
  744.          }
  745.          if(mx_internal::selectedIndexChanged)
  746.          {
  747.             selectedIndex = selectedIndex;
  748.             mx_internal::selectedIndexChanged = false;
  749.          }
  750.       }
  751.       
  752.       [Bindable("valueCommit")]
  753.       [Bindable("change")]
  754.       public function get selectedIndex() : int
  755.       {
  756.          return _selectedIndex;
  757.       }
  758.    }
  759. }
  760.  
  761.