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

  1. class application.screens.HorizontalSubNavigation 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 btn0;
  12.    var activeButton;
  13.    function HorizontalSubNavigation()
  14.    {
  15.       super();
  16.       this.instCounter = 1;
  17.       this.format = new TextFormat();
  18.       this.format.align = "left";
  19.       this.format.color = 0;
  20.       this.format.font = "Tele-GroteskNor";
  21.       this.format.leading = 2;
  22.       this.format.size = 18;
  23.       this.format1 = new TextFormat();
  24.       this.format1.align = "left";
  25.       this.format1.color = 3633064;
  26.       this.format1.font = "Tele-GroteskFet";
  27.       this.format1.leading = 2;
  28.       this.format1.size = 18;
  29.    }
  30.    function setAciveContent(activeMain, activeSub)
  31.    {
  32.       this.activeMain = activeMain;
  33.       this.activeSub = activeSub;
  34.    }
  35.    function update(activeSub)
  36.    {
  37.       this.activeSub = activeSub;
  38.       if(activeSub != 0)
  39.       {
  40.          this.showActiveButton();
  41.       }
  42.       else
  43.       {
  44.          this.hideActiveButton();
  45.       }
  46.    }
  47.    function build()
  48.    {
  49.       if(this.activeMain == 9)
  50.       {
  51.          var _loc4_ = this.dataObj.imprint.contentList;
  52.       }
  53.       else if(this.activeMain == 11)
  54.       {
  55.          _loc4_ = this.dataObj.help.contentList;
  56.       }
  57.       else
  58.       {
  59.          _loc4_ = this.dataObj.content[this.activeMain].contentList;
  60.       }
  61.       var _loc5_ = null;
  62.       var _loc3_ = 0;
  63.       while(_loc3_ < _loc4_.length - 1)
  64.       {
  65.          var _loc2_ = this.createEmptyMovieClip("btn" + _loc3_,this.instCounter++);
  66.          if(_loc3_ == 0)
  67.          {
  68.             this.buildFirstButtonGfx(_loc2_);
  69.             var _loc6_ = this.buildLabelGfx(_loc2_,_loc4_[_loc3_ + 1].label);
  70.             this.resizeButton(_loc2_,_loc6_);
  71.          }
  72.          else if(_loc3_ == _loc4_.length - 2)
  73.          {
  74.             this.buildLastButtonGfx(_loc2_);
  75.             _loc6_ = this.buildLabelGfx(_loc2_,_loc4_[_loc3_ + 1].label);
  76.             this.resizeButton(_loc2_,_loc6_);
  77.          }
  78.          else
  79.          {
  80.             this.buildButtonGfx(_loc2_);
  81.             _loc6_ = this.buildLabelGfx(_loc2_,_loc4_[_loc3_ + 1].label);
  82.             this.resizeButton(_loc2_,_loc6_);
  83.          }
  84.          if(_loc3_ != 1)
  85.          {
  86.             _loc2_._x = _loc5_._x + _loc5_._width - 1;
  87.          }
  88.          else
  89.          {
  90.             _loc2_._x = _loc5_._x + _loc5_._width - 5;
  91.          }
  92.          this.buildButton(_loc2_);
  93.          _loc2_.mainId = this.activeMain;
  94.          _loc2_.subId = _loc3_ + 1;
  95.          if(_loc3_ == 0)
  96.          {
  97.             this.createFocusRec(_loc2_,_loc2_._width - 7,_loc2_._height - 2,1,1);
  98.          }
  99.          else
  100.          {
  101.             this.createFocusRec(_loc2_,_loc2_._width - 4,_loc2_._height - 2,1,1);
  102.          }
  103.          if(this.activeMain == 9 || this.activeMain == 11)
  104.          {
  105.             application.core.FocusManager.getInstance().registerButton(_loc2_,10 + (_loc3_ + 1));
  106.          }
  107.          else
  108.          {
  109.             application.core.FocusManager.getInstance().registerButton(_loc2_,10 * (this.activeMain + 1) + (_loc3_ + 1));
  110.          }
  111.          _loc5_ = _loc2_;
  112.          _loc3_ = _loc3_ + 1;
  113.       }
  114.    }
  115.    function onButtonRollOver(mc)
  116.    {
  117.    }
  118.    function onButtonRollOut(mc)
  119.    {
  120.    }
  121.    function onButtonPress(mc)
  122.    {
  123.    }
  124.    function onButtonRelease(mc)
  125.    {
  126.       if(mc._parent != this.active)
  127.       {
  128.          this.rootMC.update(2,mc.mainId,mc.subId);
  129.       }
  130.    }
  131.    function onButtonDisable(mc)
  132.    {
  133.    }
  134.    function onButtonEnable(mc)
  135.    {
  136.    }
  137.    function buildFirstButtonGfx(mc)
  138.    {
  139.       var _loc1_ = 0;
  140.       var _loc3_ = mc.attachMovie("inactive_first_left","left",1);
  141.       _loc1_ = 10;
  142.       _loc3_ = mc.attachMovie("inactive_center","center",2);
  143.       _loc3_._x = _loc1_;
  144.       _loc1_ += mc.center._width;
  145.       _loc3_ = mc.attachMovie("inactive_right","right",3);
  146.       _loc3_._x = _loc1_;
  147.    }
  148.    function buildLastButtonGfx(mc)
  149.    {
  150.       var _loc1_ = 0;
  151.       var _loc3_ = mc.attachMovie("inactive_left","left",1);
  152.       _loc1_ = 10;
  153.       _loc3_ = mc.attachMovie("inactive_center","center",2);
  154.       _loc3_._x = _loc1_;
  155.       _loc1_ += mc.center._width;
  156.       _loc3_ = mc.attachMovie("inactive_last_right","right",3);
  157.       _loc3_._x = _loc1_;
  158.    }
  159.    function buildButtonGfx(mc)
  160.    {
  161.       var _loc1_ = 0;
  162.       var _loc3_ = mc.attachMovie("inactive_left","left",1);
  163.       _loc1_ = 10;
  164.       _loc3_ = mc.attachMovie("inactive_center","center",2);
  165.       _loc3_._x = _loc1_;
  166.       _loc1_ += mc.center._width;
  167.       _loc3_ = mc.attachMovie("inactive_right","right",3);
  168.       _loc3_._x = _loc1_;
  169.    }
  170.    function buildActiveButtonGfx(mc)
  171.    {
  172.       var _loc1_ = 0;
  173.       var _loc3_ = mc.attachMovie("active_left","left",2);
  174.       _loc1_ = 10;
  175.       _loc3_ = mc.attachMovie("active_center","center",3);
  176.       _loc3_._x = _loc1_;
  177.       _loc1_ += mc.center._width;
  178.       _loc3_ = mc.attachMovie("active_right","right",4);
  179.       _loc3_._x = _loc1_;
  180.    }
  181.    function buildLabelGfx(mc, labelText)
  182.    {
  183.       mc.createTextField("tf",6,8,0,100,22);
  184.       var _loc2_ = mc.tf;
  185.       _loc2_.autoSize = true;
  186.       _loc2_.embedFonts = true;
  187.       _loc2_.text = labelText;
  188.       _loc2_.selectable = false;
  189.       _loc2_.setTextFormat(this.format);
  190.       return _loc2_.textWidth;
  191.    }
  192.    function resizeButton(mc, width)
  193.    {
  194.       mc.center._width = width;
  195.       mc.right._x = mc.center._x + width;
  196.    }
  197.    function showActiveButton()
  198.    {
  199.       if(this.activeMain == 9)
  200.       {
  201.          var _loc6_ = this.dataObj.imprint.contentList;
  202.       }
  203.       else if(this.activeMain == 11)
  204.       {
  205.          _loc6_ = this.dataObj.help.contentList;
  206.       }
  207.       else
  208.       {
  209.          _loc6_ = this.dataObj.content[this.activeMain].contentList;
  210.       }
  211.       btn._x = 0;
  212.       var btn = this.btn0;
  213.       btn._x = 0;
  214.       var _loc2_ = btn;
  215.       var _loc3_ = 1;
  216.       while(_loc3_ < this.activeSub)
  217.       {
  218.          btn = this["btn" + _loc3_];
  219.          btn._x = _loc2_._x + _loc2_._width;
  220.          if(_loc3_ == 1)
  221.          {
  222.             btn._x -= 5;
  223.          }
  224.          else
  225.          {
  226.             btn._x -= 1;
  227.          }
  228.          _loc2_ = btn;
  229.          _loc3_ = _loc3_ + 1;
  230.       }
  231.       this.activeButton._visible = true;
  232.       this.activeButton.onEnable();
  233.       this.active.removeMovieClip();
  234.       var _loc4_ = this.createEmptyMovieClip("active",this.instCounter++);
  235.       this.activeButton = this["btn" + (this.activeSub - 1)];
  236.       this.activeButton.onDisable();
  237.       this.activeButton._visible = false;
  238.       this.buildActiveButtonGfx(_loc4_);
  239.       _loc4_.createTextField("tf",7,8,0,100,22);
  240.       var _loc5_ = _loc4_.tf;
  241.       _loc5_.autoSize = true;
  242.       _loc5_.embedFonts = true;
  243.       _loc5_.text = _loc6_[this.activeSub].label;
  244.       _loc5_.selectable = false;
  245.       _loc5_.setTextFormat(this.format1);
  246.       _loc5_.textWidth;
  247.       var _loc8_ = _loc5_.textWidth;
  248.       _loc4_.tf._y += 4;
  249.       this.resizeButton(_loc4_,_loc8_);
  250.       _loc4_._x = this.activeButton._x;
  251.       _loc4_._y = this.activeButton._y - 5;
  252.       if(this.activeSub != 1)
  253.       {
  254.          var _loc7_ = _loc4_.attachMovie("inactive_center","hider",1);
  255.          _loc7_._width = 5;
  256.          _loc7_._x = - _loc7_._width;
  257.          _loc7_._y = 5;
  258.       }
  259.       _loc4_.left.onRollOver = function()
  260.       {
  261.       };
  262.       _loc4_.left.useHandCursor = false;
  263.       _loc4_.center.onRollOver = function()
  264.       {
  265.       };
  266.       _loc4_.center.useHandCursor = false;
  267.       _loc4_.right.onRollOver = function()
  268.       {
  269.       };
  270.       _loc4_.right.useHandCursor = false;
  271.       btn = this["btn" + this.activeSub];
  272.       btn._x = this.active._x + this.active._width - 8;
  273.       _loc2_ = btn;
  274.       _loc3_ = this.activeSub + 1;
  275.       while(_loc3_ < _loc6_.length - 1)
  276.       {
  277.          btn = this["btn" + _loc3_];
  278.          btn._x = _loc2_._x + _loc2_._width;
  279.          if(_loc3_ == 1)
  280.          {
  281.             btn._x -= 5;
  282.          }
  283.          else
  284.          {
  285.             btn._x -= 1;
  286.          }
  287.          _loc2_ = btn;
  288.          _loc3_ = _loc3_ + 1;
  289.       }
  290.    }
  291.    function hideActiveButton()
  292.    {
  293.       this.activeButton._visible = true;
  294.       this.activeButton.onEnable();
  295.       this.active.removeMovieClip();
  296.       if(this.activeMain == 9)
  297.       {
  298.          var _loc5_ = this.dataObj.imprint.contentList;
  299.       }
  300.       else if(this.activeMain == 11)
  301.       {
  302.          _loc5_ = this.dataObj.help.contentList;
  303.       }
  304.       else
  305.       {
  306.          _loc5_ = this.dataObj.content[this.activeMain].contentList;
  307.       }
  308.       var _loc3_ = this.btn0;
  309.       _loc3_._x = 0;
  310.       var _loc4_ = _loc3_;
  311.       var _loc2_ = 1;
  312.       while(_loc2_ < _loc5_.length)
  313.       {
  314.          _loc3_ = this["btn" + _loc2_];
  315.          _loc3_._x = _loc4_._x + _loc4_._width;
  316.          if(_loc2_ == 1)
  317.          {
  318.             _loc3_._x -= 5;
  319.          }
  320.          else
  321.          {
  322.             _loc3_._x -= 1;
  323.          }
  324.          _loc4_ = _loc3_;
  325.          _loc2_ = _loc2_ + 1;
  326.       }
  327.    }
  328.    function onButtonReleaseOutside(mc)
  329.    {
  330.    }
  331. }
  332.