actionscript 2
Código ActionScript :
stop(); import mx.transitions.Tween; import mx.transitions.easing.*; var alphaTw:Tween; function loadMainXML(success) { if (success) { xmlNode = this.firstChild; menuText = []; menuColorOut = []; menuColorOver = []; menuPath = []; total = xmlNode.childNodes.length; for (i=0; i<total; i++) { menuText[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue; menuColorOut[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue; menuColorOver[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue; menuPath[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue; } menuSpacer = this.firstChild.attributes.menuSpacer; buildMenu(); } else { trace("Error opening XML"); } } xmlMain = new XML(); xmlMain.ignoreWhite = true; xmlMain.onLoad = loadMainXML; xmlMain.load("xml/menu.xml"); var stageListener:Object = new Object(); stageListener.onResize = function() { sizeListen(); page_mc.x = Stage.width/2; page_mc.y = Stage.height/2; settingsBox_mc.x = Stage.width/2; settingsBox_mc.y = Stage.height/2; }; Stage.addListener(stageListener); sizeListener_mc._visible = false; sizeListener_mc.enabled = false; function sizeListen() { if (Stage.height<599) { disable(); sizeListener_mc._visible = true; sizeListener_mc.enabled = true; sizeListener_mc.resizeScreen_mc._width = Stage.width; sizeListener_mc.resizeScreen_mc._height = Stage.height; sizeListener_mc.resizeText_mc._x = Stage.width/2; sizeListener_mc.resizeText_mc._y = Stage.height/2; } else if (Stage.width<1000) { disable(); sizeListener_mc._visible = true; sizeListener_mc.enabled = true; sizeListener_mc.resizeScreen_mc._width = Stage.width; sizeListener_mc.resizeScreen_mc._height = Stage.height; sizeListener_mc.resizeText_mc._x = Stage.width/2; sizeListener_mc.resizeText_mc._y = Stage.height/2; } else { enable(); sizeListener_mc._visible = false; sizeListener_mc.enabled = false; } } sizeListener_mc.resizeText_mc.sizeListenerIgnoreBtn_mc.onRelease = function() { enable(); sizeListener_mc._visible = false; sizeListener_mc.enabled = false; }; page_mc.preloader_mc._visible = false; var mcLoader:MovieClipLoader = new MovieClipLoader(); var myListener:Object = new Object(); mcLoader.addListener(myListener); myListener.onLoadProgress = function(target_mc, bytesLoaded, bytesTotal) { page_mc.preloader_mc._visible = true; var pctLoaded = Math.round(bytesLoaded/bytesTotal*100); page_mc.preloader_mc._xscale = pctLoaded; if (bytesLoaded>=bytesTotal) { alphaTw = new Tween(page_mc.myLoader, "_alpha", Regular.easeOut, 0, 100, 12, false); } }; function lineFinished() { mcLoader.loadClip(menuPath[0],page_mc.myLoader); alphaTw = new Tween(page_mc.mainMenu, "_alpha", Regular.easeOut, 0, 100, 12, false); } function buildMenu() { spacer = menuSpacer; mainMenuStartX = 0; page_mc.createEmptyMovieClip("mainMenu",page_mc.getNextHighestDepth()); page_mc.mainMenu._alpha = 0; for (i=0; i<total; i++) { page_mc.mainMenu.attachMovie("menuHolder","e"+i,i); e = page_mc.mainMenu["e"+i]; e._x = mainMenuStartX; e.menu_txt.autoSize = "left"; e.menu_txt.text = menuText[i]; e.menu_txt._y = 1; e.menu_txt._x = 35; mainMenuStartX += Number(spacer)+e._width; e.num = i; e.onRelease = function() { menuRelease(this.num); }; e.onRollOver = function() { menuRollOver(this.num); }; e.onRollOut = e.onReleaseOutside=function () { menuRollOut(this.num); }; } page_mc.mainMenu._x = (1000/2)-page_mc.mainMenu._width; page_mc.mainMenu._y = -200; function menuRelease(n) { stick(n); page_mc.myLoader.clearListener(); _root.mcLoader.loadClip(menuPath[n],page_mc.myLoader); if (n == darken-1) { bg_mc.workBg_mc.gotoAndPlay("on"); workBgStatus = "on"; } else { workBgStatusCheck(); } } function menuRollOver(n){ menuOver = new Color(page_mc.mainMenu["e"+n]); menuOver.setRGB(menuColorOver[n]); } function menuRollOut(n){ menuOut = new Color(page_mc.mainMenu["e"+n]); menuOut.setRGB(menuColorOut[n]); } stick(0); function stick(mc) { for (i=0; i<total; i++) { page_mc.mainMenu["e"+i].enabled = true; menuOut = new Color(page_mc.mainMenu["e"+i]); menuOut.setRGB(menuColorOut[i]); } page_mc.mainMenu["e"+mc].enabled = false; menuOver = new Color(page_mc.mainMenu["e"+mc]); menuOver.setRGB(menuColorOver[mc]); } }
xml
Código XML :
<main menuSpacer = "30" darken = "4"> <menu> <menuText>INICIO</menu> <menuColorOut>0xB29E91</menuColorOut> <menuColorOver>0xDE8801</menuColorOver> <menupath>inicio.swf</menupath> </menu> <menu> <menuText>MENU</menu> <menuColorOut>0xB29E91</menuColorOut> <menuColorOver>0xff9c00</menuColorOver> <menupath>menus.swf</menupath> </menu> <menu> <menuText>SALONES</menu> <menuColorOut>0xB29E91</menuColorOut> <menuColorOver>0xff9c00</menuColorOver> <menupath>salon.swf</menupath> </menu> <menu> <menuText>GALERIA</menu> <menuColorOut>0xB29E91</menuColorOut> <menuColorOver>0xff9c00</menuColorOver> <menupath>video.swf</menupath> </menu> <menu> <menuText>CONTACTO</menu> <menuColorOut>0xB29E91</menuColorOut> <menuColorOver>0xff9c00</menuColorOver> <menupath>contacto.swf</menupath> </menu> </main>
Gracias espero haya alguien que me pueda orientar se lo voy a agradecer toda la vida