home *** CD-ROM | disk | FTP | other *** search
/ Computer Active 2010 August / CA08.iso / Multimedija / shufflr.air / ShufflrClient.swf / scripts / mx / core / LayoutContainer.as < prev    next >
Encoding:
Text File  |  2010-06-23  |  4.6 KB  |  164 lines

  1. package mx.core
  2. {
  3.    import flash.events.Event;
  4.    import mx.containers.BoxDirection;
  5.    import mx.containers.utilityClasses.BoxLayout;
  6.    import mx.containers.utilityClasses.CanvasLayout;
  7.    import mx.containers.utilityClasses.ConstraintColumn;
  8.    import mx.containers.utilityClasses.ConstraintRow;
  9.    import mx.containers.utilityClasses.IConstraintLayout;
  10.    import mx.containers.utilityClasses.Layout;
  11.    
  12.    use namespace mx_internal;
  13.    
  14.    public class LayoutContainer extends Container implements IConstraintLayout
  15.    {
  16.       mx_internal static const VERSION:String = "3.5.0.12683";
  17.       
  18.       mx_internal static var useProgressiveLayout:Boolean = false;
  19.       
  20.       private var _constraintColumns:Array = [];
  21.       
  22.       protected var layoutObject:Layout = new BoxLayout();
  23.       
  24.       private var _layout:String = "vertical";
  25.       
  26.       private var processingCreationQueue:Boolean = false;
  27.       
  28.       protected var boxLayoutClass:Class = BoxLayout;
  29.       
  30.       private var resizeHandlerAdded:Boolean = false;
  31.       
  32.       private var preloadObj:Object;
  33.       
  34.       private var creationQueue:Array = [];
  35.       
  36.       private var _constraintRows:Array = [];
  37.       
  38.       protected var canvasLayoutClass:Class = CanvasLayout;
  39.       
  40.       public function LayoutContainer()
  41.       {
  42.          super();
  43.          layoutObject.target = this;
  44.       }
  45.       
  46.       public function get constraintColumns() : Array
  47.       {
  48.          return _constraintColumns;
  49.       }
  50.       
  51.       override mx_internal function get usePadding() : Boolean
  52.       {
  53.          return layout != ContainerLayout.ABSOLUTE;
  54.       }
  55.       
  56.       override protected function layoutChrome(param1:Number, param2:Number) : void
  57.       {
  58.          super.layoutChrome(param1,param2);
  59.          if(!mx_internal::doingLayout)
  60.          {
  61.             createBorder();
  62.          }
  63.       }
  64.       
  65.       public function set constraintColumns(param1:Array) : void
  66.       {
  67.          var _loc2_:int = 0;
  68.          var _loc3_:int = 0;
  69.          if(param1 != _constraintColumns)
  70.          {
  71.             _loc2_ = int(param1.length);
  72.             _loc3_ = 0;
  73.             while(_loc3_ < _loc2_)
  74.             {
  75.                ConstraintColumn(param1[_loc3_]).container = this;
  76.                _loc3_++;
  77.             }
  78.             _constraintColumns = param1;
  79.             invalidateSize();
  80.             invalidateDisplayList();
  81.          }
  82.       }
  83.       
  84.       public function set layout(param1:String) : void
  85.       {
  86.          if(_layout != param1)
  87.          {
  88.             _layout = param1;
  89.             if(layoutObject)
  90.             {
  91.                layoutObject.target = null;
  92.             }
  93.             if(_layout == ContainerLayout.ABSOLUTE)
  94.             {
  95.                layoutObject = new canvasLayoutClass();
  96.             }
  97.             else
  98.             {
  99.                layoutObject = new boxLayoutClass();
  100.                if(_layout == ContainerLayout.VERTICAL)
  101.                {
  102.                   BoxLayout(layoutObject).direction = BoxDirection.VERTICAL;
  103.                }
  104.                else
  105.                {
  106.                   BoxLayout(layoutObject).direction = BoxDirection.HORIZONTAL;
  107.                }
  108.             }
  109.             if(layoutObject)
  110.             {
  111.                layoutObject.target = this;
  112.             }
  113.             invalidateSize();
  114.             invalidateDisplayList();
  115.             dispatchEvent(new Event("layoutChanged"));
  116.          }
  117.       }
  118.       
  119.       public function get constraintRows() : Array
  120.       {
  121.          return _constraintRows;
  122.       }
  123.       
  124.       override protected function measure() : void
  125.       {
  126.          super.measure();
  127.          layoutObject.measure();
  128.       }
  129.       
  130.       override protected function updateDisplayList(param1:Number, param2:Number) : void
  131.       {
  132.          super.updateDisplayList(param1,param2);
  133.          layoutObject.updateDisplayList(param1,param2);
  134.          createBorder();
  135.       }
  136.       
  137.       [Bindable("layoutChanged")]
  138.       public function get layout() : String
  139.       {
  140.          return _layout;
  141.       }
  142.       
  143.       public function set constraintRows(param1:Array) : void
  144.       {
  145.          var _loc2_:int = 0;
  146.          var _loc3_:int = 0;
  147.          if(param1 != _constraintRows)
  148.          {
  149.             _loc2_ = int(param1.length);
  150.             _loc3_ = 0;
  151.             while(_loc3_ < _loc2_)
  152.             {
  153.                ConstraintRow(param1[_loc3_]).container = this;
  154.                _loc3_++;
  155.             }
  156.             _constraintRows = param1;
  157.             invalidateSize();
  158.             invalidateDisplayList();
  159.          }
  160.       }
  161.    }
  162. }
  163.  
  164.