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

  1. class application.screens.PreviousNextControlScreen extends application.screens.AbstractScreen implements application.models.IScreen
  2. {
  3.    var dir;
  4.    var fwasReleased;
  5.    var numberOfPages;
  6.    var contentMC;
  7.    var currentPage;
  8.    var tf2;
  9.    var btn0;
  10.    var btn1;
  11.    var mode;
  12.    var xpos;
  13.    var tf0;
  14.    var configObj;
  15.    var tf1;
  16.    var rootMC;
  17.    var templateType;
  18.    function PreviousNextControlScreen()
  19.    {
  20.       super();
  21.       this.dir = 1;
  22.       this.fwasReleased = false;
  23.    }
  24.    function reset()
  25.    {
  26.       this.dir = 1;
  27.       this.fwasReleased = false;
  28.    }
  29.    function setContentInfos(numberOfPages, contentMC)
  30.    {
  31.       this.numberOfPages = numberOfPages;
  32.       this.contentMC = contentMC;
  33.       if(this.fwasReleased)
  34.       {
  35.          if(this.dir == 1)
  36.          {
  37.             this.currentPage = 1;
  38.          }
  39.          else
  40.          {
  41.             this.currentPage = numberOfPages;
  42.          }
  43.       }
  44.       else
  45.       {
  46.          this.dir = 1;
  47.          this.currentPage = 1;
  48.       }
  49.       this.fwasReleased = false;
  50.       contentMC.gotoAndStop(this.currentPage);
  51.       this.tf2.multiline = false;
  52.       this.tf2.autoSize = true;
  53.       this.tf2.text = "Seite " + this.currentPage + " von " + numberOfPages;
  54.       if(this.btn0.hasFocus)
  55.       {
  56.          this.btn0.onSetFocus();
  57.       }
  58.       if(this.btn1.hasFocus)
  59.       {
  60.          this.btn1.onSetFocus();
  61.       }
  62.       this.posTextField();
  63.    }
  64.    function setInternalContentInfos(id, contentMC)
  65.    {
  66.       this.mode = "internal";
  67.       this.numberOfPages = contentMC.getTopicLength();
  68.       this.contentMC = contentMC;
  69.       this.currentPage = id + 1;
  70.       this.tf2.multiline = false;
  71.       this.tf2.autoSize = true;
  72.       this.tf2.text = "Seite " + this.currentPage + " von " + this.numberOfPages;
  73.       if(this.btn0.hasFocus)
  74.       {
  75.          this.btn0.onSetFocus();
  76.          application.ui.FocusBorder.getInstance().showBorder(this.btn0);
  77.       }
  78.       if(this.btn1.hasFocus)
  79.       {
  80.          this.btn1.onSetFocus();
  81.          application.ui.FocusBorder.getInstance().showBorder(this.btn1);
  82.       }
  83.       this.posTextField();
  84.    }
  85.    function build()
  86.    {
  87.       this.xpos = this.btn0._x;
  88.       this.buildButton(this.btn0);
  89.       this.createFocusRec(this.btn0,this.btn0._width,this.btn0._height,0,0);
  90.       application.core.FocusManager.getInstance().registerButton(this.btn0,96);
  91.       this.buildButton(this.btn1);
  92.       this.createFocusRec(this.btn1,this.btn1._width,this.btn1._height,0,0);
  93.       application.core.FocusManager.getInstance().registerButton(this.btn1,97);
  94.       this.tf0.autoSize = true;
  95.       this.tf0.text = this.configObj.textList.previousButtonLabel;
  96.       this.tf1.text = this.configObj.textList.nextButtonLabel;
  97.       this.posTextField();
  98.    }
  99.    function onButtonRollOver(mc)
  100.    {
  101.    }
  102.    function onButtonRollOut(mc)
  103.    {
  104.    }
  105.    function onButtonPress(mc)
  106.    {
  107.    }
  108.    function onButtonRelease(mc)
  109.    {
  110.       this.fwasReleased = true;
  111.       switch(mc._name)
  112.       {
  113.          case "btn0":
  114.             this.currentPage = this.currentPage - 1;
  115.             if(this.currentPage == 0)
  116.             {
  117.                this.rootMC.getPreviousContent();
  118.                this.dir = -1;
  119.                this.currentPage = this.currentPage + 1;
  120.             }
  121.             else
  122.             {
  123.                if(this.mode != "internal")
  124.                {
  125.                   this.contentMC.gotoAndStop(this.currentPage);
  126.                }
  127.                else
  128.                {
  129.                   this.contentMC.showNextContent(this.currentPage - 1);
  130.                }
  131.                this.tf2.autoSize = true;
  132.                this.tf2.text = "Seite " + this.currentPage + " von " + this.numberOfPages;
  133.                this.posTextField();
  134.             }
  135.             break;
  136.          case "btn1":
  137.             this.currentPage = this.currentPage + 1;
  138.             if(this.currentPage > this.numberOfPages)
  139.             {
  140.                this.rootMC.getNextContent();
  141.                this.dir = 1;
  142.                this.currentPage = this.currentPage - 1;
  143.             }
  144.             else
  145.             {
  146.                if(this.mode != "internal")
  147.                {
  148.                   this.contentMC.gotoAndStop(this.currentPage);
  149.                }
  150.                else
  151.                {
  152.                   application.debug.Logging.getInstance().showMessage("showNextContent?");
  153.                   this.contentMC.showNextContent(this.currentPage - 1);
  154.                }
  155.                this.tf2.autoSize = true;
  156.                this.tf2.text = "Seite " + this.currentPage + " von " + this.numberOfPages;
  157.                this.posTextField();
  158.             }
  159.       }
  160.    }
  161.    function onButtonDisable(mc)
  162.    {
  163.    }
  164.    function onButtonEnable(mc)
  165.    {
  166.    }
  167.    function onButtonReleaseOutside(mc)
  168.    {
  169.    }
  170.    function posTextField()
  171.    {
  172.       this.templateType = this.contentMC["templateType" + this.contentMC._currentframe];
  173.       switch(this.templateType)
  174.       {
  175.          case "B3":
  176.             this.tf2._x = 44;
  177.             this.tf2._y = 337;
  178.             break;
  179.          case "B2":
  180.             this.tf2._x = 202;
  181.             this.tf2._y = 337;
  182.             break;
  183.          case "B1":
  184.             this.tf2._x = 384;
  185.             this.tf2._y = 337;
  186.             break;
  187.          case "C2":
  188.             this.tf2._x = 384;
  189.             this.tf2._y = 337;
  190.             break;
  191.          case "C1":
  192.             this.tf2._x = 202;
  193.             this.tf2._y = 337;
  194.             break;
  195.          default:
  196.             this.tf2._x = 44;
  197.             this.tf2._y = 337;
  198.       }
  199.    }
  200. }
  201.