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;
- getProductPage(secObj.pItems[0].itemMC);
- secObj.pItems[0].itemMC.gotoAndPlay(2);
- }
- function homeButton()
- {
- 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++;
- }
- gotoAndStop(2);
- }
- 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");
- duplicateMovieClip(sectionButton,"section__home",16384 + this.getNextHighestDepth());
- secMc = _root.section__home;
- var _loc4_ = 0;
- secMc._x = _loc4_;
- secMc._y = 70;
- secMc.section_title = "Home";
- 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 = 3;
- this.secTitle._width = wd + 20;
- };
- secMc.setWidth(secMc.section_title.length * 7);
- secMc.onRelease = function()
- {
- _root.homeButton();
- doCommand("GETINTROTEXT","True");
- };
- _loc4_ += secMc._width;
- idx = String(indexData);
- sections = idx.split("---");
- sections.shift();
- debugPrint(sections.length);
- fscommand("DebugPrint",String(sections));
- debugWindow = sections.length;
- 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 = 3;
- 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;
- return "Flash Recieved: " + indexData;
- }
- function doCommand(command, someParams)
- {
- fscommand(command,someParams);
- }
- function getProductPage(itemMC)
- {
- trace(itemMC.itemData.itemName);
- if(itemMC.itemData.itemName.charAt(0) != " ")
- {
- secP = itemMC.sectionPath;
- iP = itemMC.itemData.itemPath;
- gotoAndStop("product");
- fscommand("GetProductPageDetails",secP + "|" + iP);
- }
- else
- {
- trace("Empty Item");
- }
- }
- 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_;
- }
- function loadPreRoll(preRollLocation)
- {
- skipper._visible = false;
- if(preRollLocation == "none")
- {
- preroll._visible = false;
- vid_bg._visible = false;
- skipper._visible = false;
- __init__();
- }
- else
- {
- preroll.load("Interface/pre_roll.flv");
- preroll.play();
- skipperInterval = setInterval(showSkipButton,3000);
- }
- }
- function showSkipButton()
- {
- clearInterval(skipperInterval);
- skipper._visible = true;
- }
- function skipPreRoll()
- {
- clearInterval(skipperInterval);
- preroll.pause();
- skipper._visible = false;
- preroll._visible = false;
- vid_bg._visible = false;
- __init__();
- }
- 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);
- MovieClip(preroll.getVideoPlayer(preroll.activeVideoPlayerIndex))._video.smoothing = true;
- var listenerObject = new Object();
- listenerObject.metadataReceived = function(eventObject)
- {
- var _loc8_ = 1016;
- var _loc2_ = 618;
- var _loc5_ = preroll.metadata.width;
- var _loc6_ = preroll.metadata.height;
- trace("in ratio = " + _loc5_ / _loc6_);
- var _loc9_ = undefined;
- var _loc3_ = undefined;
- var _loc1_ = undefined;
- var _loc4_ = 0;
- var _loc7_ = 0;
- _loc9_ = _loc6_ / _loc5_;
- _loc3_ = _loc8_;
- _loc1_ = _loc3_ * _loc9_;
- if(_loc1_ > _loc2_)
- {
- reduce = _loc2_ / _loc1_;
- _loc1_ *= reduce;
- _loc3_ *= reduce;
- }
- trace("out height=" + _loc1_ + " frame height=" + _loc2_);
- _loc4_ = _loc2_ - _loc1_;
- _loc7_ = (_loc8_ - _loc3_) / 2;
- trace(_loc4_);
- preroll._width = _loc3_;
- preroll._height = _loc1_;
- preroll._y = _loc4_;
- preroll._x = _loc7_;
- };
- listenerObject.complete = function(evt)
- {
- preroll._visible = false;
- vid_bg._visible = false;
- skipper._visible = false;
- _root.__init__();
- };
- preroll.addEventListener("metadataReceived",listenerObject);
- preroll.addEventListener("complete",listenerObject);
- var skipperInterval;
- flash.external.ExternalInterface.addCallback("LoadPreRoll",null,loadPreRoll);
- var sectionsIndex = new Array();
- Stage.scaleMode = "showall";
- fscommand("checkPreRoll","0");
-