AS2
Código ActionScript :
import mx.transitions.Tween; import mx.transitions.easing.*; new Tween(forte, "_alpha", Strong.easeInOut, 0, 100, 3, true); function addButtons() { pushOverX = 0; for (i=0; i<obj.buttons.length; i++) { btn = menu.attachMovie("button", "btn"+i, -i, {_x:pushOverX, id:i}); btn.t.autoSize = "left"; btn.t.text = obj.buttons[i].attributes.title; btn.t.textColor = 0xffffff; btn.back._width = btn.t._width; pushOverX += Math.round(btn._width+bS); setBtnEvents(btn); } selectFirstBtn(); var cl:Color = new Color(menu.bar); cl.setRGB(0xCCFF00); } function setBtnEvents(btn:MovieClip) { btn.onRollOver = function() { btn = this; st = obj.buttons[btn.id].attributes.title; btn.t.textColor = 0xCCFF00; typeText(btn.t,st,0,5); menu.bar.tweenX.stop(); menu.bar.tweenWidth.stop(); menu.bar.tweenX = new Tween(menu.bar, "_x", Strong.easeOut, menu.bar._x, btn._x, .6, true); menu.bar.tweenWidth = new Tween(menu.bar, "_width", Strong.easeOut, menu.bar._width, btn.back._width, .6, true); pressedBtn.t.textColor = 0xffffff; typeText(pressedBtn.t,obj.buttons[pressedBtn.id].attributes.title,0,1); s.start(); }; btn.onRollOut = function() { btn = this; st = obj.buttons[btn.id].attributes.title; btn.t.textColor = 0xffffff; typeText(btn.t,st,0,1); menu.bar.tweenX.stop(); menu.bar.tweenWidth.stop(); menu.bar.tweenX = new Tween(menu.bar, "_x", Strong.easeOut, menu.bar._x, pressedBtn._x, .6, true); menu.bar.tweenWidth = new Tween(menu.bar, "_width", Strong.easeOut, menu.bar._width, pressedBtn.back._width, .6, true); pressedBtn.t.textColor = 0xCCFF00; typeText(pressedBtn.t,obj.buttons[pressedBtn.id].attributes.title,0,5); }; btn.onPress = function() { pressedBtn.enabled = true; pressedBtn = this; this.enabled = false; //ADD HERE CUSTOM FUNCTION st = obj.buttons[pressedBtn.id].attributes + ""; demoFunction(st); }; } function selectFirstBtn(){ pressedBtn = menu.btn0; pressedBtn.enabled = false; menu.bar.tweenX = new Tween(menu.bar, "_x", Strong.easeOut, menu.bar._x, pressedBtn._x, .6, true); menu.bar.tweenWidth = new Tween(menu.bar, "_width", Strong.easeOut, menu.bar._width, pressedBtn.back._width, .6, true); pressedBtn.t.textColor = 0xCCFF00; typeText(pressedBtn.t,obj.buttons[pressedBtn.id].attributes.title,0,5); } function typeText(t:TextField, finalString:String, initRandomStringLength:Number, speed:Number) { var currentLength:Number = 0; var counter:Number = 0; t._parent.onEnterFrame = function() { if (currentLength<finalString.length) { counter++; var currentString:String = ""; var randString:String = ""; for (i=currentLength; i<initRandomStringLength; i++) { randString += String.fromCharCode(random(50)+20); } for (i=0; i<=currentLength; i++) { currentString += finalString.charAt(i); } if (counter>=speed || randString.charAt(stL) == finalString.charAt(stL)) { currentLength++; counter = 0; } if (initRandomStringLength<finalString.length-1) { initRandomStringLength++; } t.text = currentString+randString; } else { delete t._parent.onEnterFrame; } }; } var tC:Number = new Number();//text color var tROC:Number = new Number();//rollover text color var bS:Number = new Number();//buttons spacing var pressedBtn:MovieClip = new MovieClip(); var obj:Object = new Object(); var xml:XML = new XML(); xml.ignoreWhite = true; xml.onLoad = function(succes) { if (succes) { tC = Number(this.firstChild.attributes.textColor); tROC = Number(this.firstChild.attributes.rolloverColor); bS = Number(this.firstChild.attributes.spacing); obj.buttons = this.firstChild.childNodes; addButtons(); } else { trace("xml could not load"); } }; xml.load("menu.xml");
y este es el xml
Código XML :
<menu> <item title="Home"/> <item title="About us"/> <item title="Products"/> <item title="Laboratories"/> <item title="Contact"/> </menu>
porfavor si alguien me pudiera ayuda ya intente muchas cosa seor nada funciona
PD: necesito ponerle al xml el nombre del archivo k kiero k cargue ejemplo contact contacto.swf porfa favor alguna alma k se apiade de mi