home *** CD-ROM | disk | FTP | other *** search
/ T-Online 6 / T-Online.iso / Animation / content / intro / intro.swf / scripts / __Packages / application / screens / VerticalSubNavigation.as < prev   
Encoding:
Text File  |  2005-10-20  |  5.8 KB  |  215 lines

  1. class application.screens.VerticalSubNavigation extends application.screens.AbstractScreen implements application.models.IScreen
  2. {
  3.    var maxTfWidth;
  4.    var line;
  5.    var instCounter;
  6.    var format;
  7.    var format1;
  8.    var activeMain;
  9.    var activeSub;
  10.    var dataObj;
  11.    var active;
  12.    var rootMC;
  13.    var activeButton;
  14.    function VerticalSubNavigation()
  15.    {
  16.       super();
  17.       this.maxTfWidth = null;
  18.       this.line = null;
  19.       this.instCounter = 1;
  20.       this.format = new TextFormat();
  21.       this.format.align = "left";
  22.       this.format.color = 0;
  23.       this.format.font = "Tele-GroteskNor";
  24.       this.format.leading = 2;
  25.       this.format.size = 18;
  26.       this.format1 = new TextFormat();
  27.       this.format1.align = "left";
  28.       this.format1.color = 3633064;
  29.       this.format1.font = "Tele-GroteskFet";
  30.       this.format1.leading = 2;
  31.       this.format1.size = 18;
  32.    }
  33.    function setAciveContent(activeMain, activeSub)
  34.    {
  35.       this.activeMain = activeMain;
  36.       this.activeSub = activeSub;
  37.    }
  38.    function update(activeSub)
  39.    {
  40.       this.activeSub = activeSub;
  41.       if(activeSub != 0)
  42.       {
  43.          this.showActiveButton();
  44.       }
  45.       else
  46.       {
  47.          this.hideActiveButton();
  48.       }
  49.    }
  50.    function build()
  51.    {
  52.       if(this.activeMain == 4)
  53.       {
  54.          var _loc4_ = this.dataObj.benefit.contentList;
  55.          var _loc6_ = 170;
  56.       }
  57.       else
  58.       {
  59.          _loc4_ = this.dataObj.tonline.contentList;
  60.          _loc6_ = 170;
  61.       }
  62.       var _loc5_ = null;
  63.       var _loc2_ = 0;
  64.       while(_loc2_ < _loc4_.length - 1)
  65.       {
  66.          var _loc7_ = this.createEmptyMovieClip("btn" + _loc2_,this.instCounter++);
  67.          this.buildButtonGfx(_loc7_,_loc6_);
  68.          var _loc3_ = this.buildLabelGfx(_loc7_,_loc4_[_loc2_ + 1].label);
  69.          if(_loc3_ > this.maxTfWidth)
  70.          {
  71.             _loc3_ = this.maxTfWidth;
  72.          }
  73.          if(_loc2_ != 0)
  74.          {
  75.             _loc7_._y = _loc5_._y + 24;
  76.          }
  77.          this.buildButton(_loc7_);
  78.          _loc7_.mainId = this.activeMain;
  79.          _loc7_.subId = _loc2_ + 1;
  80.          if(_loc2_ == 0)
  81.          {
  82.             this.createFocusRec(_loc7_,_loc7_._width - 1,_loc7_._height - 5,_loc7_._x,1);
  83.          }
  84.          else
  85.          {
  86.             this.createFocusRec(_loc7_,_loc7_._width - 1,_loc7_._height - 4,_loc7_._x,0);
  87.          }
  88.          application.core.FocusManager.getInstance().registerButton(_loc7_,10 * (this.activeMain + 1) + (_loc2_ + 1));
  89.          _loc5_ = _loc7_;
  90.          _loc2_ = _loc2_ + 1;
  91.       }
  92.       _loc7_ = this.attachMovie("verticalSubNavigation_lastpice","lastpice",this.instCounter++);
  93.       var _loc8_ = (_loc4_.length - 1) * 24;
  94.       _loc7_._width = _loc6_;
  95.       _loc7_._height = 302 - _loc8_;
  96.       _loc7_._y = _loc8_;
  97.    }
  98.    function onButtonRollOver(mc)
  99.    {
  100.    }
  101.    function onButtonRollOut(mc)
  102.    {
  103.    }
  104.    function onButtonPress(mc)
  105.    {
  106.    }
  107.    function onButtonRelease(mc)
  108.    {
  109.       if(mc._parent != this.active)
  110.       {
  111.          this.rootMC.update(3,mc.mainId,mc.subId);
  112.       }
  113.    }
  114.    function onButtonDisable(mc)
  115.    {
  116.    }
  117.    function onButtonEnable(mc)
  118.    {
  119.    }
  120.    function buildButtonGfx(mc, btnWidth)
  121.    {
  122.       var _loc1_ = mc.attachMovie("verticalSubNavigation_inactive","btn",1);
  123.       _loc1_._width = btnWidth;
  124.       _loc1_.gotoAndStop(1);
  125.    }
  126.    function buildActiveButtonGfx(mc, btnWidth)
  127.    {
  128.       var _loc2_ = null;
  129.       if(this.activeSub != 1)
  130.       {
  131.          _loc2_ = mc.attachMovie("verticalSubNavigation_active","btn",2);
  132.       }
  133.       else
  134.       {
  135.          _loc2_ = mc.attachMovie("verticalSubNavigation_first_active","btn",2);
  136.       }
  137.       _loc2_._width = btnWidth;
  138.    }
  139.    function buildLabelGfx(mc, labelText)
  140.    {
  141.       mc.createTextField("tf",6,13,-1,100,22);
  142.       var _loc2_ = mc.tf;
  143.       _loc2_.autoSize = true;
  144.       _loc2_.embedFonts = true;
  145.       _loc2_.text = labelText;
  146.       _loc2_.selectable = false;
  147.       _loc2_.setTextFormat(this.format);
  148.       return _loc2_.textWidth;
  149.    }
  150.    function showActiveButton()
  151.    {
  152.       if(this.activeMain == 4)
  153.       {
  154.          var _loc4_ = this.dataObj.benefit.contentList;
  155.       }
  156.       else
  157.       {
  158.          _loc4_ = this.dataObj.tonline.contentList;
  159.       }
  160.       var _loc5_ = 170;
  161.       this.activeButton._visible = true;
  162.       this.activeButton.onEnable();
  163.       this.active.removeMovieClip();
  164.       var _loc2_ = this.createEmptyMovieClip("active",this.instCounter++);
  165.       this.activeButton = this["btn" + (this.activeSub - 1)];
  166.       _loc2_._x = this.activeButton._x;
  167.       if(this.activeSub != 1)
  168.       {
  169.          _loc2_._y = this.activeButton._y - 2;
  170.       }
  171.       else
  172.       {
  173.          _loc2_._y = this.activeButton._y;
  174.       }
  175.       this.activeButton.onDisable();
  176.       this.activeButton._visible = false;
  177.       this.buildActiveButtonGfx(_loc2_,_loc5_);
  178.       _loc2_.createTextField("tf",10,13,-1,100,22);
  179.       var _loc3_ = _loc2_.tf;
  180.       _loc3_.autoSize = true;
  181.       _loc3_.embedFonts = true;
  182.       _loc3_.text = _loc4_[this.activeSub].label;
  183.       _loc3_.selectable = false;
  184.       _loc3_.setTextFormat(this.format1);
  185.       _loc3_._x = this.activeButton.tf._x;
  186.       if(this.activeSub != 1)
  187.       {
  188.          _loc3_._y += 2;
  189.       }
  190.       _loc2_.btn.useHandCursor = false;
  191.       _loc2_.btn.onRollOver = function()
  192.       {
  193.       };
  194.       if(this.line == null)
  195.       {
  196.          this.line = this.attachMovie("line","line",20000);
  197.          this.line._x = this.activeButton._x + 169;
  198.       }
  199.    }
  200.    function hideActiveButton()
  201.    {
  202.       this.activeButton._visible = true;
  203.       this.activeButton.onEnable();
  204.       this.active.removeMovieClip();
  205.       if(this.line != null)
  206.       {
  207.          this.line.removeMovieClip();
  208.          this.line = null;
  209.       }
  210.    }
  211.    function onButtonReleaseOutside(mc)
  212.    {
  213.    }
  214. }
  215.