home *** CD-ROM | disk | FTP | other *** search
/ T-Online 6 / T-Online.iso / Animation / content / intro / intro.swf / scripts / __Packages / components / ui / gridLayout / GridLayout.as
Encoding:
Text File  |  2005-10-20  |  4.1 KB  |  116 lines

  1. class components.ui.gridLayout.GridLayout
  2. {
  3.    var instCounter;
  4.    var layout;
  5.    var container;
  6.    var grid;
  7.    function GridLayout()
  8.    {
  9.       this.instCounter = 0;
  10.    }
  11.    function setLayout(layout)
  12.    {
  13.       this.layout = layout;
  14.    }
  15.    function setContainer(container)
  16.    {
  17.       this.container = container;
  18.    }
  19.    function render()
  20.    {
  21.       this.grid = [];
  22.       var _loc12_ = 0;
  23.       var _loc9_ = 0;
  24.       var _loc6_ = 0;
  25.       var _loc4_ = 0;
  26.       while(_loc4_ < this.layout.numberOfRows)
  27.       {
  28.          this.grid[_loc4_] = [];
  29.          var _loc3_ = 0;
  30.          while(_loc3_ < this.layout.numberOfCols)
  31.          {
  32.             this.grid[_loc4_][_loc3_] = {};
  33.             if(this.layout.cells[_loc4_ * this.layout.numberOfCols + _loc3_] != null)
  34.             {
  35.                var _loc7_ = _loc4_ * this.layout.numberOfCols + _loc3_;
  36.                var _loc11_ = this.grid[_loc4_][_loc3_];
  37.                var _loc2_ = this.container.attachMovie("cell","cell" + this.instCounter,this.instCounter++);
  38.                if(this.layout.cells[_loc7_ + 1] != null || _loc3_ == this.layout.numberOfCols - 1)
  39.                {
  40.                   _loc2_.front._width = this.layout.rowWidths[_loc3_];
  41.                }
  42.                else
  43.                {
  44.                   _loc6_ = this.layout.rowWidths[_loc3_];
  45.                   var _loc8_ = _loc7_;
  46.                   var _loc5_ = _loc3_;
  47.                   while(_loc5_ < this.layout.numberOfCols - 1)
  48.                   {
  49.                      if(this.layout.cells[_loc8_ + 1] != null)
  50.                      {
  51.                         break;
  52.                      }
  53.                      _loc6_ += this.layout.rowWidths[_loc5_ + 1] + this.layout.horizotalSpace;
  54.                      _loc8_ = _loc8_ + 1;
  55.                      _loc5_ = _loc5_ + 1;
  56.                   }
  57.                   _loc2_.front._width = _loc6_;
  58.                }
  59.                if(this.layout.cells[_loc7_ + this.layout.numberOfCols] != null || _loc4_ == this.layout.numberOfRows - 1)
  60.                {
  61.                   _loc2_.front._height = this.layout.colHeights[_loc4_];
  62.                }
  63.                else
  64.                {
  65.                   _loc6_ = this.layout.colHeights[_loc4_];
  66.                   _loc8_ = _loc7_;
  67.                   _loc5_ = _loc4_;
  68.                   while(_loc5_ < this.layout.numberOfRows - 1)
  69.                   {
  70.                      if(this.layout.cells[_loc8_ + this.layout.numberOfCols] != null)
  71.                      {
  72.                         break;
  73.                      }
  74.                      _loc6_ += this.layout.colHeights[_loc5_ + 1] + this.layout.verticalSpace;
  75.                      _loc8_ += this.layout.numberOfCols;
  76.                      _loc5_ = _loc5_ + 1;
  77.                   }
  78.                   _loc2_.front._height = _loc6_;
  79.                }
  80.                var _loc10_ = new Color(_loc2_.front);
  81.                _loc10_.setRGB(this.layout.colors[_loc4_ * this.layout.numberOfCols + _loc3_]);
  82.                _loc2_._x = _loc9_;
  83.                _loc2_._y = _loc12_;
  84.                _loc11_.mc = _loc2_;
  85.                _loc9_ = _loc2_._x + this.layout.rowWidths[_loc3_] + this.layout.horizotalSpace;
  86.                if(_loc3_ < this.layout.numberOfCols - 1)
  87.                {
  88.                   _loc2_.back._width = _loc2_.front._width + this.layout.horizotalSpace;
  89.                }
  90.                else
  91.                {
  92.                   _loc2_.back._width = _loc2_.front._width;
  93.                }
  94.                if(_loc4_ < this.layout.numberOfRows - 1)
  95.                {
  96.                   _loc2_.back._height = _loc2_.front._height + this.layout.verticalSpace;
  97.                }
  98.                else
  99.                {
  100.                   _loc2_.back._height = _loc2_.front._height;
  101.                }
  102.             }
  103.             else
  104.             {
  105.                _loc9_ = _loc9_ + this.layout.rowWidths[_loc3_] + this.layout.horizotalSpace;
  106.             }
  107.             _loc3_ = _loc3_ + 1;
  108.          }
  109.          _loc9_ = 0;
  110.          _loc12_ += this.layout.colHeights[_loc4_] + this.layout.verticalSpace;
  111.          _loc4_ = _loc4_ + 1;
  112.       }
  113.       return this.grid;
  114.    }
  115. }
  116.