Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 8.10 KB  |  hits: 29  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. btFullScreen._visible = false;
  2. loadConfig ();
  3. initMenus ();
  4. //
  5. logoPng._alpha = 0;
  6. //
  7. function loadConfig () {
  8.         var config:XML = new XML ();
  9.         config.ignoreWhite = true;
  10.         config.onLoad = function (success) {
  11.                 if (success) {
  12.                         var root:XMLNode = this.firstChild;
  13.                         var bgMusic:String = this.firstChild.childNodes[0].childNodes[0].nodeValue;
  14.                         var bgImage:String = this.firstChild.childNodes[1].childNodes[0].nodeValue;
  15.                         var footer:String = this.firstChild.childNodes[2].childNodes[0].nodeValue;
  16.                         var siteRoot:String = this.firstChild.childNodes[3].childNodes[0].nodeValue;
  17.                         var fullscreen:String = this.firstChild.childNodes[4].childNodes[0].nodeValue;
  18.                 }
  19.                 loadMenu ();
  20.                 loadMovieClip (bgImage,bgImageContainer,"ini");
  21.                 footertxt_mc.footerMsg.htmlText = footer;
  22.                 track = bgMusic;
  23.                 readSound (track);
  24.                 sitePath = siteRoot;
  25.                 if(fullscreen == "true"){
  26.                         btFullScreen._visible = true;
  27.                 }
  28.         };
  29.         config.load ("xml/config.xml");
  30. }
  31.  
  32. function loadMenu () {
  33.         var menu:XML = new XML ();
  34.         menu.ignoreWhite = true;
  35.         menus.scrollbar._visible = false;
  36.         menus.scrollbar.pan._y = 15;
  37.         menu.onLoad = function (success) {
  38.                 if (success) {
  39.                         var root:XMLNode = this.firstChild;
  40.                         for (i = 0; i < root.childNodes.length; i++) {
  41.                                 var titleItem:String = root.childNodes[i].childNodes[0].childNodes[0].nodeValue;
  42.                                 var textItem:String = root.childNodes[i].childNodes[1].childNodes[0].nodeValue;
  43.                                 menus.menusIn.attachMovie ("titleMenu","titleMenu" + i,i);
  44.                                 if (i == 0) {
  45.                                         menus.menusIn["titleMenu" + i]._y = 36;
  46.                                 }
  47.                                 else {
  48.                                         menus.menusIn["titleMenu" + i]._y = 36 + i * 36;
  49.                                 }
  50.                                 menus.menusIn["titleMenu" + i].title.title.htmlText = titleItem;
  51.                                 menus.menusIn["titleMenu" + i].bt.instance = i;
  52.                                 menus.menusIn["titleMenu" + i].bt.instanceText = textItem;
  53.                                 menus.id = i;
  54.                                 menus.menusIn["titleMenu" + i].bt.onPress = function () {
  55.                                         contentInstance = this.instance;
  56.                                         if (this.instanceText == "submenu") {
  57.                                                 controlMenu ("openAll");
  58.                                                 loadSubMenu ();
  59.                                         }
  60.                                         else {
  61.                                                 _root.commingContent = "menu";
  62.                                                 tempNav = nav;
  63.                                                 nav = 1;
  64.                                                 gotoSwf ();
  65.                                                 ZigoEngine.doTween (menus.subMenu,'_x',-185,1,"easeInOutExpo")
  66.                                         }
  67.                                 };
  68.                         }
  69.                 }
  70.                 checkScroll (menus.scrollbar,menus.menusIn,Stage.height);
  71.         };
  72.         menu.load ("xml/main.xml");
  73. }
  74.  
  75. function checkScroll (scrollMc:MovieClip, contentMc:MovieClip, limit:Number) {
  76.         if (contentMc._height > limit) {
  77.                 scrollMc._visible = true;
  78.         }
  79.         else {
  80.                 scrollMc._visible = false;
  81.         }
  82. }
  83.  
  84. function loadSubMenu () {
  85.         //
  86.         for (a = 0; a < totalSubMenuItems; a++) {
  87.                 removeMovieClip (menus.subMenu.containerSub["titleMenu" + a]);
  88.         }
  89.         //
  90.         var subMenu:XML = new XML ();
  91.         subMenu.ignoreWhite = true;
  92.         menus.subMenu.scrollbarSub._visible = false;
  93.         menus.subMenu.scrollbarSub.pan._y = 15;
  94.         subMenu.onLoad = function (success) {
  95.                 if (success) {
  96.                         var root:XMLNode = this.firstChild.childNodes[_level0.contentInstance].childNodes[2];
  97.                         totalSubMenuItems = root.childNodes.length;
  98.                         for (i = 0; i < root.childNodes.length; i++) {
  99.                                 var titleSubMenu:String = root.childNodes[i].childNodes[0].childNodes[0].nodeValue;
  100.                                 var contentSubMenu:String = root.childNodes[i].childNodes[1].childNodes[0].nodeValue;
  101.                                 menus.subMenu.containerSub.attachMovie ("titleMenu","titleMenu" + i,i);
  102.                                 menus.subMenu.containerSub["titleMenu" + i]._y = i * 36;
  103.                                 menus.subMenu.containerSub["titleMenu" + i].title.title.htmlText = titleSubMenu;
  104.                                 menus.subMenu.containerSub["titleMenu" + i].bt.instance = i;
  105.                                 menus.subMenu.containerSub["titleMenu" + i].bt.onPress = function () {
  106.                                         contentSubInstance = this.instance;
  107.                                         _root.commingContent = "submenu";
  108.                                         tempNav = nav;
  109.                                         nav = 1;
  110.                                         gotoSwf ();
  111.                                 };
  112.                         }
  113.                 }
  114.                 checkScroll (menus.subMenu.scrollbarSub,menus.subMenu.containerSub,Stage.height);
  115.         };
  116.         subMenu.load ("xml/main.xml");
  117. }
  118.  
  119. function controlMenu (action:String) {
  120.         if (action == "open") {
  121.                 ZigoEngine.doTween (menus,'_x',Math.floor(0),0.5,"easeInOutExpo");
  122.                 //ZigoEngine.doTween (menus.subMenu,'_x',-175,0.5,"easeInOutExpo");
  123.                 attachMovie ("controlRight","controlRight",0);
  124.                 controlRight._height = Stage.height;
  125.                 controlRight._x = 800;
  126.                 controlRight.onRollOver = function () {
  127.                         this.useHandCursor = false;
  128.                         controlMenu ("close");
  129.                 };
  130.         }
  131.         else if (action == "close") {
  132.                 ZigoEngine.doTween (menus,'_x',Math.floor(-156),1,"easeInOutExpo");
  133.                 ZigoEngine.doTween (menus.subMenu,'_x',-175,0.5,"easeInOutExpo");
  134.                 attachMovie ("controlLeft","controlLeft",0);
  135.                 controlLeft.controlLeft_mc._height = Stage.height;
  136.                 controlLeft.onRollOver = function () {
  137.                         this.useHandCursor = false;
  138.                         controlMenu ("open");
  139.                 };
  140.         }
  141.         else if (action == "openAll") {
  142.                 ZigoEngine.doTween (menus.subMenu,'_x',175,0.5,"easeInOutExpo");
  143.                 attachMovie ("controlRight2","controlRight2",0);
  144.                 controlRight2._height = Stage.height;
  145.                 controlRight2._x = 1000;
  146.                 controlRight2.onRollOver = function () {
  147.                         this.useHandCursor = false;
  148.                         controlMenu ("closeAll");
  149.                 };
  150.         }
  151.         else if (action == "closeAll") {
  152.                 ZigoEngine.doTween (menus.subMenu,'_x',-175,1,"easeInOutExpo",0,function () {
  153.                 removeGalleries ();
  154.                 });
  155.                 ZigoEngine.doTween (menus,'_x',Math.floor(-156),1,"easeInOutExpo",0.3);
  156.                 attachMovie ("controlLeft","controlLeft",0);
  157.                 controlLeft.onRollOver = function () {
  158.                         this.useHandCursor = false;
  159.                         controlMenu ("open");
  160.                 };
  161.         }
  162. }
  163.  
  164. function initMenus () {
  165.         menus._x = Math.floor(-185);
  166.         menus.subMenu._x = -175;
  167. }
  168.  
  169. function loadMovieClip (externalTarget:String, targetRoot:MovieClip, action:String) {
  170.         var mcLoader:MovieClipLoader = new MovieClipLoader ();
  171.         var listenerLoad:Object = new Object ();
  172.         listenerLoad.onLoadStart = function (target:MovieClip) {
  173.                 attachMovie ("loader","loader",1);
  174.                 loader._x = Math.floor (Stage.width / 2);
  175.                 loader._y = Math.floor (Stage.height / 2);
  176.                 targetRoot._alpha = 0;
  177.                 loader.bar._xscale = 0;
  178.                 isLoading = true;
  179.         };
  180.         listenerLoad.onLoadProgress = function (target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void  {
  181.                 percent = Math.round (bytesLoaded / bytesTotal * 100);
  182.                 ZigoEngine.doTween (loader.bar,'_xscale',percent,2,"easeOutExpo");
  183.         };
  184.         listenerLoad.onLoadComplete = function (target:MovieClip):Void  {
  185.                 if (action == "ini") {
  186.                         ZigoEngine.doTween (logoPng,'_alpha',100,2,"easeOutExpo");
  187.                         controlMenu ("open");
  188.                         ZigoEngine.doTween (targetRoot,'_alpha',100,2,"easeOutExpo");
  189.                 }
  190.                 ZigoEngine.doTween (loader,'_alpha',100,0,"easeOutExpo",0,function () {
  191.                 removeMovieClip (loader);
  192.                 });
  193.                 isLoading = false;
  194.         };
  195.         mcLoader.addListener (listenerLoad);
  196.         mcLoader.loadClip (externalTarget,targetRoot);
  197. }
  198.  
  199. function readSound (track:String) {
  200.         my_sound.onLoad = function (success:Boolean) {
  201.                 if (success) {
  202.                        
  203.                         // If we decided to turn on the sound
  204.                         if(melodyControl == true)
  205.                         {
  206.                                 // Let's start the sound!
  207.                                 my_sound.start();
  208.                         }
  209.                         else
  210.                         {                              
  211.                                 my_sound.stop ();
  212.                                 trace ("Sound loaded!");
  213.                                 //my_sound.setVolume(0);
  214.                                 melodyControl = false;
  215.                                 soundStat.text = "off";
  216.                                 my_sound.onSoundComplete = function () {
  217.                                         my_sound.start ();
  218.                                         //my_sound.setVolume(10)
  219.                                 }
  220.                         }
  221.                 }
  222.                 else {
  223.                         trace ("sound not loaded");
  224.                 }
  225.         };
  226.        
  227.         my_sound.loadSound (track,false);
  228.        
  229. }
  230.  
  231. function controlMelody () {
  232.         if (melodyControl == true) {
  233.                 melodyControl = false;
  234.                 my_sound.stop ();
  235.                 soundStat.text = "off";
  236.         }
  237.         else if (melodyControl == false) {
  238.                 readSound (track);
  239.                 melodyControl = true;
  240.                 soundStat.text = "on";
  241.         }
  242. }
  243.  
  244. function loadNavSwf () {
  245.         unloadMovie (containerContents);
  246.         switch (nav) {
  247.                 case 0 :
  248.                         ZigoEngine.doTween (logoPng,'_alpha',100,2,"easeOutExpo");
  249.                         break;
  250.                 case 1 :
  251.                         loadMovie ("contents.swf", containerContents);
  252.                         ZigoEngine.doTween (logoPng,'_alpha',0,2,"easeOutExpo");
  253.                         break;
  254.         }
  255. }
  256.  
  257. function gotoSwf () {
  258.         switch (tempNav) {
  259.                 case 0 :
  260.                         if (isLoading == true) {
  261.                                 loadNavSwf ();
  262.                         }
  263.                         else {
  264.                                 exitHomePage ();
  265.                         }
  266.                         break;
  267.                 case 1 :
  268.                         if (isLoading == true) {
  269.                                 loadNavSwf ();
  270.                         }
  271.                         else {
  272.                                 containerContents.exitContents ();
  273.                         }
  274.                         break;
  275.         }
  276. }
  277.  
  278. function exitHomePage () {
  279.         loadNavSwf ();
  280. }