home *** CD-ROM | disk | FTP | other *** search
- function __init__()
- {
- var ow = 1016;
- var oh = 638;
- var _loc1_ = new Object();
- _loc1_.onLoadComplete = function(target_mc)
- {
- target_mc.forceSmoothing = true;
- };
- _loc1_.onLoadInit = function(target_mc)
- {
- if(target_mc._width > target_mc._height)
- {
- ratio = ow / target_mc._width;
- off = (oh - target_mc._height * ratio) / 2;
- target_mc._height *= ratio;
- target_mc._width *= ratio;
- }
- else
- {
- ratio = oh / target_mc._height;
- off = (ow - target_mc._width * ratio) / 2;
- target_mc._x = off;
- target_mc._height *= ratio;
- target_mc._width *= ratio;
- }
- };
- mcl = new MovieClipLoader();
- mcl.addListener(_loc1_);
- mcl.loadClip("./Interface/mainbackdrop.png",backdrop_image);
- var _loc2_ = new LoadVars();
- _loc2_.onData = function(dat)
- {
- if(dat)
- {
- createMenuSystem(dat);
- }
- };
- _loc2_.load("./Interface/menu_items.txt");
- sectionButton._visible = false;
- item_button._visible = false;
- doCommand("GETINTROTEXT","True");
- }
- function SectionObject(pName, pPath, mc)
- {
- secObj = new Object();
- secObj.sectionPath = trimString(pPath);
- secObj.sectionName = pName;
- secObj.pItems = [];
- secObj.secMC = mc;
- return secObj;
- }
- function itemObject(pName, pPath, mc)
- {
- itemObj = new Object();
- itemObj.itemPath = trimString(pPath);
- itemObj.itemName = pName;
- itemObj.itemMC = mc;
- itemObj.itemMC.titleName = itemObj.itemName;
- return itemObj;
- }
- function hideSectionsOtherThan(secObj)
- {
- s = 0;
- while(s < _root.sectionsIndex.length)
- {
- if(_root.sectionsIndex[s].secMC.clicked == true)
- {
- _root.sectionsIndex[s].secMC.clicked = false;
- _root.sectionsIndex[s].secMC.gotoAndPlay(21);
- }
- it = 0;
- while(it < _root.sectionsIndex[s].pItems.length)
- {
- _root.sectionsIndex[s].pItems[it].itemMC._visible = false;
- it++;
- }
- s++;
- }
- it = 0;
- while(it < secObj.pItems.length)
- {
- secObj.pItems[it].itemMC._visible = true;
- it++;
- }
- secObj.secMC.clicked = true;
- }
- function debugPrint(args)
- {
- fscommand("DebugPrint",args);
- }
- function TestPythonFunction(myArg)
- {
- _root.backdrop_image._visible = false;
- return "yes";
- }
- function MakeProductPage(gameTitle, infoText, images, bData)
- {
- game_title = gameTitle;
- infoDisplay.info_text = infoText;
- makeProductButtons(bData);
- imgsList = images.split("|");
- screenDisplay.loadImages(imgsList);
- }
- function setIntroImages(imgs)
- {
- screenDisplay.loadImages(imgs.split("|"));
- }
- function introTextRecieved(welcomeText, introText, issueText)
- {
- issueNumber = issueText;
- game_title = welcomeText;
- infoDisplay.info_text = introText;
- }
- function makeProductButtons(args)
- {
- buttonList = args.split("%%");
- var _loc2_ = Array("but1","but2","but3","but4","but5","but6");
- bn = 0;
- while(bn < _loc2_.length)
- {
- if(bn < buttonList.length - 1)
- {
- comTxt = buttonList[bn];
- _root[_loc2_[bn]].buttonText = comTxt;
- _root[_loc2_[bn]]._visible = true;
- }
- else
- {
- _root[_loc2_[bn]]._visible = false;
- }
- bn++;
- }
- }
- function createMenuSystem(indexData)
- {
- debugPrint("CreateMenuSystem Called HERE");
- idx = String(indexData);
- sections = idx.split("---");
- sections.shift();
- debugPrint(sections.length);
- fscommand("DebugPrint",String(sections));
- debugWindow = sections.length;
- var _loc4_ = 0;
- var _loc3_ = 100;
- pHeight = item_button._height;
- sec = 0;
- while(sec < sections.length)
- {
- pItems = sections[sec].split("-");
- sectionDetails = pItems[0].split("@");
- duplicateMovieClip(sectionButton,"section__" + sec,16384 + this.getNextHighestDepth());
- secMc = _root["section__" + sec];
- cSection = SectionObject(sectionDetails[0],sectionDetails[1],secMc);
- sectionsIndex.push(cSection);
- secMc._x = _loc4_;
- secMc._y = 70;
- secMc.sectionObject = cSection;
- currentSection = cSection;
- secMc.section_title = currentSection.sectionName;
- secMc.setWidth = function(wd)
- {
- this.butty.left_cap._x = 0;
- this.butty.backer._width = wd;
- this.butty.right_cap._x = this.butty.backer._x + this.butty.backer._width + this.butty.right_cap._width;
- this.secTitle._x = 8;
- this.secTitle._width = wd + 20;
- };
- secMc.setWidth(secMc.section_title.length * 7);
- secMc.onRelease = function()
- {
- _root.hideSectionsOtherThan(this.sectionObject);
- };
- _loc3_ = 100;
- i = 1;
- while(i < pItems.length)
- {
- iName = String(sec + "__" + i);
- itemDetails = pItems[i].split("@");
- duplicateMovieClip(item_button,iName,16384 + this.getNextHighestDepth());
- mc = _root[iName];
- itemOb = itemObject(itemDetails[0],itemDetails[1],mc);
- currentSection.pItems.push(itemOb);
- mc._x = 0;
- mc._y = _loc3_;
- mc.sectionPath = currentSection.sectionPath;
- mc.itemData = itemOb;
- mc.onRelease = function()
- {
- _root.getProductPage(this);
- };
- _loc3_ += pHeight;
- i++;
- }
- _loc4_ += secMc._width;
- item = 0;
- while(item < cSection.pItems.length)
- {
- cSection.pItems[item].itemMC._visible = false;
- item++;
- }
- sec++;
- }
- secMc._visible = true;
- hideSectionsOtherThan(sectionsIndex[0]);
- sectionsIndex[0].secMC.gotoAndStop(20);
- sectionsIndex[0].secMC.clicked = true;
- return "Flash Recieved: " + indexData;
- }
- function doCommand(command, someParams)
- {
- fscommand(command,someParams);
- }
- function getProductPage(itemMC)
- {
- secP = itemMC.sectionPath;
- iP = itemMC.itemData.itemPath;
- gotoAndStop("product");
- fscommand("GetProductPageDetails",secP + "|" + iP);
- }
- function trimString(par_String)
- {
- var _loc2_ = "";
- c = 0;
- while(c < par_String.length - 1)
- {
- if(par_String.charAt(c) != " " && par_String.charAt(c) != "\n")
- {
- _loc2_ += par_String.charAt(c);
- }
- c++;
- }
- return _loc2_;
- }
- function rTrim(string)
- {
- var _loc2_ = "";
- ch = string.length;
- while(ch > 0)
- {
- if(!(string[ch] == " " || string[ch] == "\n"))
- {
- _loc2_ += string[ch];
- }
- ch--;
- }
- return _loc2_;
- }
- stop();
- flash.external.ExternalInterface.addCallback("TestPythonFunction",null,TestPythonFunction);
- flash.external.ExternalInterface.addCallback("MakeProductPage",null,MakeProductPage);
- flash.external.ExternalInterface.addCallback("SetIntroImages",null,setIntroImages);
- flash.external.ExternalInterface.addCallback("IntroTextRecieved",null,introTextRecieved);
- flash.external.ExternalInterface.addCallback("CreateMenuSystem",null,createMenuSystem);
- var sectionsIndex = new Array();
- Stage.scaleMode = "showall";
- __init__();
-