home *** CD-ROM | disk | FTP | other *** search
- class application.screens.PreviousNextControlScreen extends application.screens.AbstractScreen implements application.models.IScreen
- {
- var dir;
- var fwasReleased;
- var numberOfPages;
- var contentMC;
- var currentPage;
- var tf2;
- var btn0;
- var btn1;
- var mode;
- var xpos;
- var tf0;
- var configObj;
- var tf1;
- var rootMC;
- var templateType;
- function PreviousNextControlScreen()
- {
- super();
- this.dir = 1;
- this.fwasReleased = false;
- }
- function reset()
- {
- this.dir = 1;
- this.fwasReleased = false;
- }
- function setContentInfos(numberOfPages, contentMC)
- {
- this.numberOfPages = numberOfPages;
- this.contentMC = contentMC;
- if(this.fwasReleased)
- {
- if(this.dir == 1)
- {
- this.currentPage = 1;
- }
- else
- {
- this.currentPage = numberOfPages;
- }
- }
- else
- {
- this.dir = 1;
- this.currentPage = 1;
- }
- this.fwasReleased = false;
- contentMC.gotoAndStop(this.currentPage);
- this.tf2.multiline = false;
- this.tf2.autoSize = true;
- this.tf2.text = "Seite " + this.currentPage + " von " + numberOfPages;
- if(this.btn0.hasFocus)
- {
- this.btn0.onSetFocus();
- }
- if(this.btn1.hasFocus)
- {
- this.btn1.onSetFocus();
- }
- this.posTextField();
- }
- function setInternalContentInfos(id, contentMC)
- {
- this.mode = "internal";
- this.numberOfPages = contentMC.getTopicLength();
- this.contentMC = contentMC;
- this.currentPage = id + 1;
- this.tf2.multiline = false;
- this.tf2.autoSize = true;
- this.tf2.text = "Seite " + this.currentPage + " von " + this.numberOfPages;
- if(this.btn0.hasFocus)
- {
- this.btn0.onSetFocus();
- application.ui.FocusBorder.getInstance().showBorder(this.btn0);
- }
- if(this.btn1.hasFocus)
- {
- this.btn1.onSetFocus();
- application.ui.FocusBorder.getInstance().showBorder(this.btn1);
- }
- this.posTextField();
- }
- function build()
- {
- this.xpos = this.btn0._x;
- this.buildButton(this.btn0);
- this.createFocusRec(this.btn0,this.btn0._width,this.btn0._height,0,0);
- application.core.FocusManager.getInstance().registerButton(this.btn0,96);
- this.buildButton(this.btn1);
- this.createFocusRec(this.btn1,this.btn1._width,this.btn1._height,0,0);
- application.core.FocusManager.getInstance().registerButton(this.btn1,97);
- this.tf0.autoSize = true;
- this.tf0.text = this.configObj.textList.previousButtonLabel;
- this.tf1.text = this.configObj.textList.nextButtonLabel;
- this.posTextField();
- }
- function onButtonRollOver(mc)
- {
- }
- function onButtonRollOut(mc)
- {
- }
- function onButtonPress(mc)
- {
- }
- function onButtonRelease(mc)
- {
- this.fwasReleased = true;
- switch(mc._name)
- {
- case "btn0":
- this.currentPage = this.currentPage - 1;
- if(this.currentPage == 0)
- {
- this.rootMC.getPreviousContent();
- this.dir = -1;
- this.currentPage = this.currentPage + 1;
- }
- else
- {
- if(this.mode != "internal")
- {
- this.contentMC.gotoAndStop(this.currentPage);
- }
- else
- {
- this.contentMC.showNextContent(this.currentPage - 1);
- }
- this.tf2.autoSize = true;
- this.tf2.text = "Seite " + this.currentPage + " von " + this.numberOfPages;
- this.posTextField();
- }
- break;
- case "btn1":
- this.currentPage = this.currentPage + 1;
- if(this.currentPage > this.numberOfPages)
- {
- this.rootMC.getNextContent();
- this.dir = 1;
- this.currentPage = this.currentPage - 1;
- }
- else
- {
- if(this.mode != "internal")
- {
- this.contentMC.gotoAndStop(this.currentPage);
- }
- else
- {
- application.debug.Logging.getInstance().showMessage("showNextContent?");
- this.contentMC.showNextContent(this.currentPage - 1);
- }
- this.tf2.autoSize = true;
- this.tf2.text = "Seite " + this.currentPage + " von " + this.numberOfPages;
- this.posTextField();
- }
- }
- }
- function onButtonDisable(mc)
- {
- }
- function onButtonEnable(mc)
- {
- }
- function onButtonReleaseOutside(mc)
- {
- }
- function posTextField()
- {
- this.templateType = this.contentMC["templateType" + this.contentMC._currentframe];
- switch(this.templateType)
- {
- case "B3":
- this.tf2._x = 44;
- this.tf2._y = 337;
- break;
- case "B2":
- this.tf2._x = 202;
- this.tf2._y = 337;
- break;
- case "B1":
- this.tf2._x = 384;
- this.tf2._y = 337;
- break;
- case "C2":
- this.tf2._x = 384;
- this.tf2._y = 337;
- break;
- case "C1":
- this.tf2._x = 202;
- this.tf2._y = 337;
- break;
- default:
- this.tf2._x = 44;
- this.tf2._y = 337;
- }
- }
- }
-