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

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