- btFullScreen._visible = false;
- loadConfig ();
- initMenus ();
- //
- logoPng._alpha = 0;
- //
- function loadConfig () {
- var config:XML = new XML ();
- config.ignoreWhite = true;
- config.onLoad = function (success) {
- if (success) {
- var root:XMLNode = this.firstChild;
- var bgMusic:String = this.firstChild.childNodes[0].childNodes[0].nodeValue;
- var bgImage:String = this.firstChild.childNodes[1].childNodes[0].nodeValue;
- var footer:String = this.firstChild.childNodes[2].childNodes[0].nodeValue;
- var siteRoot:String = this.firstChild.childNodes[3].childNodes[0].nodeValue;
- var fullscreen:String = this.firstChild.childNodes[4].childNodes[0].nodeValue;
- }
- loadMenu ();
- loadMovieClip (bgImage,bgImageContainer,"ini");
- footertxt_mc.footerMsg.htmlText = footer;
- track = bgMusic;
- readSound (track);
- sitePath = siteRoot;
- if(fullscreen == "true"){
- btFullScreen._visible = true;
- }
- };
- config.load ("xml/config.xml");
- }
- function loadMenu () {
- var menu:XML = new XML ();
- menu.ignoreWhite = true;
- menus.scrollbar._visible = false;
- menus.scrollbar.pan._y = 15;
- menu.onLoad = function (success) {
- if (success) {
- var root:XMLNode = this.firstChild;
- for (i = 0; i < root.childNodes.length; i++) {
- var titleItem:String = root.childNodes[i].childNodes[0].childNodes[0].nodeValue;
- var textItem:String = root.childNodes[i].childNodes[1].childNodes[0].nodeValue;
- menus.menusIn.attachMovie ("titleMenu","titleMenu" + i,i);
- if (i == 0) {
- menus.menusIn["titleMenu" + i]._y = 36;
- }
- else {
- menus.menusIn["titleMenu" + i]._y = 36 + i * 36;
- }
- menus.menusIn["titleMenu" + i].title.title.htmlText = titleItem;
- menus.menusIn["titleMenu" + i].bt.instance = i;
- menus.menusIn["titleMenu" + i].bt.instanceText = textItem;
- menus.id = i;
- menus.menusIn["titleMenu" + i].bt.onPress = function () {
- contentInstance = this.instance;
- if (this.instanceText == "submenu") {
- controlMenu ("openAll");
- loadSubMenu ();
- }
- else {
- _root.commingContent = "menu";
- tempNav = nav;
- nav = 1;
- gotoSwf ();
- ZigoEngine.doTween (menus.subMenu,'_x',-185,1,"easeInOutExpo")
- }
- };
- }
- }
- checkScroll (menus.scrollbar,menus.menusIn,Stage.height);
- };
- menu.load ("xml/main.xml");
- }
- function checkScroll (scrollMc:MovieClip, contentMc:MovieClip, limit:Number) {
- if (contentMc._height > limit) {
- scrollMc._visible = true;
- }
- else {
- scrollMc._visible = false;
- }
- }
- function loadSubMenu () {
- //
- for (a = 0; a < totalSubMenuItems; a++) {
- removeMovieClip (menus.subMenu.containerSub["titleMenu" + a]);
- }
- //
- var subMenu:XML = new XML ();
- subMenu.ignoreWhite = true;
- menus.subMenu.scrollbarSub._visible = false;
- menus.subMenu.scrollbarSub.pan._y = 15;
- subMenu.onLoad = function (success) {
- if (success) {
- var root:XMLNode = this.firstChild.childNodes[_level0.contentInstance].childNodes[2];
- totalSubMenuItems = root.childNodes.length;
- for (i = 0; i < root.childNodes.length; i++) {
- var titleSubMenu:String = root.childNodes[i].childNodes[0].childNodes[0].nodeValue;
- var contentSubMenu:String = root.childNodes[i].childNodes[1].childNodes[0].nodeValue;
- menus.subMenu.containerSub.attachMovie ("titleMenu","titleMenu" + i,i);
- menus.subMenu.containerSub["titleMenu" + i]._y = i * 36;
- menus.subMenu.containerSub["titleMenu" + i].title.title.htmlText = titleSubMenu;
- menus.subMenu.containerSub["titleMenu" + i].bt.instance = i;
- menus.subMenu.containerSub["titleMenu" + i].bt.onPress = function () {
- contentSubInstance = this.instance;
- _root.commingContent = "submenu";
- tempNav = nav;
- nav = 1;
- gotoSwf ();
- };
- }
- }
- checkScroll (menus.subMenu.scrollbarSub,menus.subMenu.containerSub,Stage.height);
- };
- subMenu.load ("xml/main.xml");
- }
- function controlMenu (action:String) {
- if (action == "open") {
- ZigoEngine.doTween (menus,'_x',Math.floor(0),0.5,"easeInOutExpo");
- //ZigoEngine.doTween (menus.subMenu,'_x',-175,0.5,"easeInOutExpo");
- attachMovie ("controlRight","controlRight",0);
- controlRight._height = Stage.height;
- controlRight._x = 800;
- controlRight.onRollOver = function () {
- this.useHandCursor = false;
- controlMenu ("close");
- };
- }
- else if (action == "close") {
- ZigoEngine.doTween (menus,'_x',Math.floor(-156),1,"easeInOutExpo");
- ZigoEngine.doTween (menus.subMenu,'_x',-175,0.5,"easeInOutExpo");
- attachMovie ("controlLeft","controlLeft",0);
- controlLeft.controlLeft_mc._height = Stage.height;
- controlLeft.onRollOver = function () {
- this.useHandCursor = false;
- controlMenu ("open");
- };
- }
- else if (action == "openAll") {
- ZigoEngine.doTween (menus.subMenu,'_x',175,0.5,"easeInOutExpo");
- attachMovie ("controlRight2","controlRight2",0);
- controlRight2._height = Stage.height;
- controlRight2._x = 1000;
- controlRight2.onRollOver = function () {
- this.useHandCursor = false;
- controlMenu ("closeAll");
- };
- }
- else if (action == "closeAll") {
- ZigoEngine.doTween (menus.subMenu,'_x',-175,1,"easeInOutExpo",0,function () {
- removeGalleries ();
- });
- ZigoEngine.doTween (menus,'_x',Math.floor(-156),1,"easeInOutExpo",0.3);
- attachMovie ("controlLeft","controlLeft",0);
- controlLeft.onRollOver = function () {
- this.useHandCursor = false;
- controlMenu ("open");
- };
- }
- }
- function initMenus () {
- menus._x = Math.floor(-185);
- menus.subMenu._x = -175;
- }
- function loadMovieClip (externalTarget:String, targetRoot:MovieClip, action:String) {
- var mcLoader:MovieClipLoader = new MovieClipLoader ();
- var listenerLoad:Object = new Object ();
- listenerLoad.onLoadStart = function (target:MovieClip) {
- attachMovie ("loader","loader",1);
- loader._x = Math.floor (Stage.width / 2);
- loader._y = Math.floor (Stage.height / 2);
- targetRoot._alpha = 0;
- loader.bar._xscale = 0;
- isLoading = true;
- };
- listenerLoad.onLoadProgress = function (target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
- percent = Math.round (bytesLoaded / bytesTotal * 100);
- ZigoEngine.doTween (loader.bar,'_xscale',percent,2,"easeOutExpo");
- };
- listenerLoad.onLoadComplete = function (target:MovieClip):Void {
- if (action == "ini") {
- ZigoEngine.doTween (logoPng,'_alpha',100,2,"easeOutExpo");
- controlMenu ("open");
- ZigoEngine.doTween (targetRoot,'_alpha',100,2,"easeOutExpo");
- }
- ZigoEngine.doTween (loader,'_alpha',100,0,"easeOutExpo",0,function () {
- removeMovieClip (loader);
- });
- isLoading = false;
- };
- mcLoader.addListener (listenerLoad);
- mcLoader.loadClip (externalTarget,targetRoot);
- }
- function readSound (track:String) {
- my_sound.onLoad = function (success:Boolean) {
- if (success) {
- // If we decided to turn on the sound
- if(melodyControl == true)
- {
- // Let's start the sound!
- my_sound.start();
- }
- else
- {
- my_sound.stop ();
- trace ("Sound loaded!");
- //my_sound.setVolume(0);
- melodyControl = false;
- soundStat.text = "off";
- my_sound.onSoundComplete = function () {
- my_sound.start ();
- //my_sound.setVolume(10)
- }
- }
- }
- else {
- trace ("sound not loaded");
- }
- };
- my_sound.loadSound (track,false);
- }
- function controlMelody () {
- if (melodyControl == true) {
- melodyControl = false;
- my_sound.stop ();
- soundStat.text = "off";
- }
- else if (melodyControl == false) {
- readSound (track);
- melodyControl = true;
- soundStat.text = "on";
- }
- }
- function loadNavSwf () {
- unloadMovie (containerContents);
- switch (nav) {
- case 0 :
- ZigoEngine.doTween (logoPng,'_alpha',100,2,"easeOutExpo");
- break;
- case 1 :
- loadMovie ("contents.swf", containerContents);
- ZigoEngine.doTween (logoPng,'_alpha',0,2,"easeOutExpo");
- break;
- }
- }
- function gotoSwf () {
- switch (tempNav) {
- case 0 :
- if (isLoading == true) {
- loadNavSwf ();
- }
- else {
- exitHomePage ();
- }
- break;
- case 1 :
- if (isLoading == true) {
- loadNavSwf ();
- }
- else {
- containerContents.exitContents ();
- }
- break;
- }
- }
- function exitHomePage () {
- loadNavSwf ();
- }