home *** CD-ROM | disk | FTP | other *** search
- class application.screens.HelpScreen extends application.screens.AbstractScreen implements application.models.IScreen
- {
- var instCounter;
- var contentCounter;
- var scrollBar;
- var lastContent;
- var contentHolder;
- var lastTopic;
- var format;
- var format1;
- var contentXML;
- var activeSub;
- var background;
- var configPath;
- var dataObj;
- var topics;
- var container;
- var configObj;
- var rootMC;
- var onEnterFrame;
- function HelpScreen()
- {
- super();
- this.instCounter = 1;
- this.contentCounter = 1;
- this.scrollBar = null;
- this.lastContent = null;
- this.contentHolder = null;
- this.lastTopic = null;
- this.format = new TextFormat();
- this.format.align = "left";
- this.format.color = 0;
- this.format.font = "Tele-GroteskNor";
- this.format.leading = 2;
- this.format.size = 16;
- this.format1 = new TextFormat();
- this.format1.align = "left";
- this.format1.color = 14811252;
- this.format1.font = "Tele-GroteskNor";
- this.format1.leading = 2;
- this.format1.size = 16;
- }
- function onLoadXMLHelp(data)
- {
- this.contentXML = new XML();
- this.contentXML.ignoreWhite = true;
- this.contentXML.parseXML(data);
- this.parseXML();
- }
- function update(activeSub, subContent)
- {
- this.activeSub = activeSub;
- this.lastTopic = null;
- this.contentHolder.removeMovieClip();
- this.background.clear();
- this.background.removeMovieClip();
- this.background = this.createEmptyMovieClip("background" + this.contentCounter,this.instCounter++);
- this.contentHolder = this.createEmptyMovieClip("contentHolder" + this.contentCounter,this.instCounter++);
- this.contentCounter = this.contentCounter + 1;
- var _loc16_ = 20;
- if(subContent == null)
- {
- application.core.FocusManager.getInstance().reset();
- if(this.lastContent != activeSub)
- {
- this.lastContent = activeSub;
- this.configPath = this.dataObj.help.contentList[activeSub].site;
- if(this.configPath.indexOf(".swf",0) == -1)
- {
- var _loc14_ = new XML();
- _loc14_.ignoreWhite = true;
- var xmlHolder = this;
- _loc14_.onLoad = function(succsess)
- {
- if(succsess)
- {
- xmlHolder.onLoadXMLHelp(this);
- }
- };
- _loc14_.load(this.configPath);
- }
- else
- {
- this.loadSWF(this.configPath);
- }
- }
- else
- {
- this.build();
- }
- }
- else
- {
- var _loc8_ = 123;
- var _loc4_ = {h:0,w:0};
- var _loc3_ = 0;
- while(_loc3_ < this.topics[subContent].answer.length)
- {
- this.container = this.contentHolder.createEmptyMovieClip("cont" + this.instCounter,this.instCounter++);
- this.container._x = 43;
- this.container._y = _loc8_;
- if(this.topics[subContent].answer[_loc3_].indexOf("<img") == -1)
- {
- var _loc6_ = new application.ui.DynamicHelpTextfield();
- _loc6_.setContainer(this.container);
- _loc6_.setTopic(this.topics);
- var _loc5_ = _loc6_.run(subContent,_loc3_);
- this.lastTopic = _loc5_.mc;
- _loc5_.h += 12;
- _loc4_.h += int(_loc5_.h);
- _loc8_ += int(_loc5_.h);
- if(_loc5_.w > _loc4_.w)
- {
- _loc4_.w = _loc5_.w;
- }
- }
- else
- {
- var _loc10_ = this.topics[subContent].answer[_loc3_];
- var _loc2_ = _loc10_.indexOf("src=") + 5;
- var _loc11_ = _loc10_.indexOf("\"",_loc2_);
- var _loc9_ = _loc10_.substring(_loc2_,_loc11_);
- _loc2_ = _loc10_.indexOf("width=") + 7;
- _loc11_ = _loc10_.indexOf("\"",_loc2_);
- var _loc13_ = Number(_loc10_.substring(_loc2_,_loc11_));
- _loc2_ = _loc10_.indexOf("height=") + 8;
- _loc11_ = _loc10_.indexOf("\"",_loc2_);
- var _loc12_ = Number(_loc10_.substring(_loc2_,_loc11_));
- _loc10_ = this.configObj.FILEPREFIX + this.configObj.HELP + _loc9_;
- this.container.loadMovie(_loc10_);
- _loc5_ = {h:_loc12_ + 12,w:_loc13_};
- _loc4_.h += _loc5_.h;
- _loc8_ += _loc5_.h;
- if(_loc5_.w > _loc4_.w)
- {
- _loc4_.w = _loc5_.w;
- }
- }
- _loc3_ = _loc3_ + 1;
- }
- this.background.beginFill(16777215,100);
- this.background.moveTo(22,107);
- this.background.lineTo(22,123 + _loc4_.h + 4);
- this.background.lineTo(560,123 + _loc4_.h + 4);
- this.background.lineTo(560,107);
- this.background.lineTo(22,107);
- this.background.endFill();
- this.rootMC.updateView(this.background._height,true,subContent);
- _loc4_ = {};
- }
- }
- function getTopicLength()
- {
- return this.topics.length;
- }
- function showNextContent(subContent)
- {
- this.update(this.lastContent,subContent);
- }
- function build()
- {
- var _loc3_ = 0;
- while(_loc3_ < this.topics.length)
- {
- var _loc6_ = this.contentHolder.createEmptyMovieClip("topic" + _loc3_,this.instCounter++);
- var _loc4_ = this.format.getTextExtent(_loc3_ + 1 + ". " + this.topics[_loc3_].question,465);
- _loc6_.createTextField("tf",2,23,0,_loc4_.textFieldWidth,_loc4_.textFieldHeight);
- var _loc5_ = _loc6_.tf;
- _loc5_.autoSize = false;
- _loc5_.embedFonts = true;
- _loc5_.multiline = true;
- _loc5_.wordWrap = true;
- _loc5_.selectable = false;
- _loc5_.border = false;
- _loc5_.html = true;
- _loc5_.htmlText = this.topics[_loc3_].question;
- _loc5_.setTextFormat(this.format);
- _loc6_.createTextField("tf1",3,0,0,25,_loc4_.textFieldHeight);
- _loc5_ = _loc6_.tf1;
- _loc5_.autoSize = false;
- _loc5_.embedFonts = true;
- _loc5_.multiline = true;
- _loc5_.wordWrap = true;
- _loc5_.selectable = false;
- _loc5_.border = false;
- _loc5_.html = true;
- if(_loc3_ + 1 >= 10)
- {
- _loc5_.htmlText = _loc3_ + 1 + ". ";
- }
- else
- {
- _loc5_.htmlText = "0" + (_loc3_ + 1) + ". ";
- }
- _loc5_.setTextFormat(this.format);
- _loc5_ = _loc6_.tf;
- var _loc2_ = _loc6_.createEmptyMovieClip("background",1);
- _loc2_.clear();
- _loc2_.beginFill(16777215,0);
- _loc2_.moveTo(0,0);
- _loc2_.lineTo(0,_loc4_.textFieldHeight);
- _loc2_.lineTo(_loc4_.textFieldWidth + 20,_loc4_.textFieldHeight);
- _loc2_.lineTo(_loc4_.textFieldWidth + 20,0);
- _loc2_.lineTo(0,0);
- _loc2_.endFill();
- this.buildButton(_loc2_);
- _loc6_.btnID = _loc3_;
- this.createFocusRec(_loc2_,_loc2_._width,_loc6_._height,0,0);
- application.core.FocusManager.getInstance().registerButton(_loc2_,40 + _loc3_);
- if(this.lastTopic != null)
- {
- _loc6_._y = this.lastTopic._y + this.lastTopic._height + 5;
- _loc6_._x = this.lastTopic._x;
- }
- else
- {
- _loc6_._y = 123;
- _loc6_._x = 43;
- }
- this.lastTopic = _loc6_;
- _loc3_ = _loc3_ + 1;
- }
- _loc6_ = this.background;
- _loc6_.clear();
- _loc6_.moveTo(22,107);
- _loc6_.beginFill(16777215,100);
- _loc6_.lineTo(22,this.lastTopic._y + this.lastTopic._height + 16);
- _loc6_.lineTo(560,this.lastTopic._y + this.lastTopic._height + 16);
- _loc6_.lineTo(560,107);
- _loc6_.lineTo(22,107);
- _loc6_.endFill();
- this.rootMC.updateView(this.background._height,false,null);
- }
- function onButtonRollOver(mc)
- {
- var _loc2_ = mc._parent.tf;
- _loc2_.setTextFormat(this.format1);
- _loc2_ = mc._parent.tf1;
- _loc2_.setTextFormat(this.format1);
- }
- function onButtonRollOut(mc)
- {
- var _loc2_ = mc._parent.tf;
- _loc2_.setTextFormat(this.format);
- _loc2_ = mc._parent.tf1;
- _loc2_.setTextFormat(this.format);
- }
- function onButtonPress(mc)
- {
- }
- function onButtonRelease(mc)
- {
- var _loc4_ = mc._parent.btnID;
- var _loc2_ = 0;
- while(_loc2_ < this.topics.length)
- {
- var _loc3_ = this.contentHolder["topic" + _loc2_].background;
- application.core.FocusManager.getInstance().unregister(_loc3_.tabId,_loc3_);
- _loc2_ = _loc2_ + 1;
- }
- this.rootMC.showInfo(_loc4_);
- }
- function onButtonDisable(mc)
- {
- }
- function onButtonEnable(mc)
- {
- }
- function parseXML(success)
- {
- var _loc4_ = this.contentXML.firstChild;
- this.topics = [];
- var _loc2_ = 0;
- while(_loc2_ < _loc4_.childNodes.length)
- {
- this.topics[_loc2_] = {question:_loc4_.childNodes[_loc2_].childNodes[0].firstChild.nodeValue};
- this.topics[_loc2_].answer = [];
- var _loc3_ = 0;
- while(_loc3_ < _loc4_.childNodes[_loc2_].childNodes[1].childNodes.length)
- {
- this.topics[_loc2_].answer[_loc3_] = _loc4_.childNodes[_loc2_].childNodes[1].childNodes[_loc3_].firstChild.nodeValue;
- _loc3_ = _loc3_ + 1;
- }
- _loc2_ = _loc2_ + 1;
- }
- this.build();
- }
- function onButtonReleaseOutside(mc)
- {
- }
- function loadSWF(url)
- {
- this.contentHolder.loadMovie(url);
- this.onEnterFrame = function()
- {
- if(this.contentHolder.getBytesLoaded() >= this.contentHolder.getBytesTotal() && this.contentHolder.getBytesTotal() >= 10)
- {
- delete this.onEnterFrame;
- this.rootMC.updateView(this.contentHolder._height,false,null);
- }
- };
- }
- }
-